{"id":3670,"date":"2013-05-21T00:47:55","date_gmt":"2013-05-20T22:47:55","guid":{"rendered":"http:\/\/icelandgeology.net\/?p=3670"},"modified":"2013-05-21T01:57:01","modified_gmt":"2013-05-20T23:57:01","slug":"technical-help-needed-for-a-script-issue","status":"publish","type":"post","link":"https:\/\/icelandgeology.net\/?p=3670","title":{"rendered":"Technical help needed for a script issue"},"content":{"rendered":"<p>I need some technical help, for the reason that I am not a programmer and I never have. I guess that I never am going to be one, since I lack the talent of doing numerical math (I possibly have <a href=\"http:\/\/en.wikipedia.org\/wiki\/Dyscalculia\" target=\"_blank\">dyscalculia<\/a>).<\/p>\n<p>I problem is this, I run a internal counter on my local server. This counter helps me by telling me the total number of earthquakes during the day, week, month and a year in Iceland, it is really useful when large earthquake swarm takes place. <\/p>\n<p>I used <a href=\"http:\/\/www.gentoo.org\/\" target=\"_blank\">Gentoo Linux<\/a> on my server, but I have now moved over to <a href=\"http:\/\/www.freebsd.org\/\" target=\"_blank\">FreeBSD<\/a> for technical and practical reasons. The move to FreeBSD did work as I expected, with the exception of this counter, it does not work in FreeBSD, I do not get any reading to <a href=\"http:\/\/oss.oetiker.ch\/mrtg\/\" target=\"_blank\">mrtg<\/a> (the counter software). The script I have been testing work when run from command line, but when I run the cron job on them. Nothing more happens and no data is handed over to mrtg.<\/p>\n<p>Here are the scripts,<\/p>\n<blockquote><p>#!\/usr\/local\/bin\/bash<\/p>\n<p>#earthquake count shell V0.0.6<\/p>\n<p>URL=&#8221;http:\/\/hraun.vedur.is\/ja\/englishweb\/eqlist.html&#8221;<br \/>\nTODAYSDATE=`date +%Y-%m-%d`<br \/>\n#TODAYSDATE=`date +%Y\/%m\/%d`<br \/>\n#TODAYSDATE=`date +%Y-%m-%d`<\/p>\n<p>COUNT=`lynx -dump ${URL} | grep ${TODAYSDATE} | grep -vi updated | wc -l`<br \/>\n#COUNT=`wget -O ${URL} | grep ${TODAYSDATE} | grep -vi updated | wc -l`<br \/>\necho ${COUNT}<br \/>\necho ${COUNT}<br \/>\n#echo ${COUNT}<br \/>\n#echo &#8220;uptime&#8221;<br \/>\n#echo &#8220;hostname&#8221;<\/p>\n<p>exit 0\n<\/p><\/blockquote>\n<p>This script does not give me any error, but no data is handed over to mrtg as it did in Gentoo Linux. I do not know why that it and I have been unable to resolve this issue.<\/p>\n<p>The second script I was testing is this one here, more details and discussions can be found <a href=\"http:\/\/forums.freebsd.org\/showthread.php?t=39592\" target=\"_blank\">here<\/a> on <a href=\"http:\/\/www.freebsd.org\/\" target=\"_blank\">FreeBSD<\/a> forum.<\/p>\n<blockquote><p>#!\/usr\/local\/bin\/bash<\/p>\n<p>#earthquake count shell V0.0.7<\/p>\n<p>URL=&#8221;http:\/\/hraun.vedur.is\/ja\/englishweb\/eqlist.html&#8221;<br \/>\nTODAY=`date +%Y-%m-%d`<br \/>\nHOURS=`date +%H`<br \/>\nMINUTES=`date +%M`<br \/>\nOUT=&#8221;$TODAY.txt&#8221;<\/p>\n<p>NOW=`echo &#8220;($HOURS * 60) + $MINUTES&#8221; | bc`<br \/>\nEARTHNUM=`wget &#8211;quiet -O &#8211; $URL | grep $TODAY | grep -vci updated`<\/p>\n<p>if [ $OUT ]; then<br \/>\n   touch $OUT<br \/>\nfi<\/p>\n<p>echo &#8220;$NOW     $EARTHNUM&#8221; >> $OUT<\/p>\n<p>exit 0<\/p><\/blockquote>\n<p>When run in mrtg, I get this error here. The script runs without a issue when run it from command line.<\/p>\n<blockquote><p>2013-05-20 22:46:09: WARNING: Could not get any data from external command &#8216;\/usr\/local\/etc\/mrtg\/eq.imo.sh&#8217;<br \/>\nMaybe the external command did not even start. (Illegal seek)<\/p>\n<p>2013-05-20 22:46:09: WARNING: Problem with External get &#8216;\/usr\/local\/etc\/mrtg\/eq.imo.sh&#8217;:<br \/>\n   Expected a Number for &#8216;in&#8217; but nothing&#8217;<\/p>\n<p>2013-05-20 22:46:09: WARNING: Problem with External get &#8216;\/usr\/local\/etc\/mrtg\/eq.imo.sh&#8217;:<br \/>\n   Expected a Number for &#8216;out&#8217; but nothing&#8217;<\/p>\n<p>2013-05-20 22:46:09: ERROR: Target[localhost_eq][_IN_] &#8216; $target->[0]{$mode} &#8216; did not eval into defined data<br \/>\n2013-05-20 22:46:09: ERROR: Target[localhost_eq][_OUT_] &#8216; $target->[0]{$mode} &#8216; did not eval into defined data<\/p><\/blockquote>\n<p>I am bit lost what is the issue here, since the script works from command line. If anyone out there has any idea what this might be. A help is most welcomed in this matter, since I am no programmer at all and I have little understanding on how to deal with this problem.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I need some technical help, for the reason that I am not a programmer and I never have. I guess that I never am going to be one, since I lack the talent of doing numerical math (I possibly have dyscalculia). I problem is this, I run a internal counter on my local server. This &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/icelandgeology.net\/?p=3670\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Technical help needed for a script issue&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[],"class_list":["post-3670","post","type-post","status-publish","format-standard","hentry","category-website"],"_links":{"self":[{"href":"https:\/\/icelandgeology.net\/index.php?rest_route=\/wp\/v2\/posts\/3670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icelandgeology.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icelandgeology.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icelandgeology.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/icelandgeology.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3670"}],"version-history":[{"count":4,"href":"https:\/\/icelandgeology.net\/index.php?rest_route=\/wp\/v2\/posts\/3670\/revisions"}],"predecessor-version":[{"id":3674,"href":"https:\/\/icelandgeology.net\/index.php?rest_route=\/wp\/v2\/posts\/3670\/revisions\/3674"}],"wp:attachment":[{"href":"https:\/\/icelandgeology.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icelandgeology.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icelandgeology.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}