I am able to run following script as my Target in the config file from the command line..But when it comes to running it from cron it just skips the "system" line and gives the error that "it cannot find the file"..Why this could happen...not good at perl...Thanks
#! /usr/local/bin/perl # # WEATHER.PL v0.01 # # try to grab Magdeburg info from weatherground.com # and to display only needed content... at least it # should do so. ################################################### # by Frank Reppin (2002) # [EMAIL PROTECTED] ################################################### # too small to license... pick GPL or sth similiar. # # Ah ... and thanks to the ppl at wunderground.com # for providing worldwide weather data. # # You only need to edit $this_host .... # and you have to grab the correct URL to your city # from www.wunderground.com # Magdeburg is 10361.html in this working example. # This script behaves fine now since some weeks, # I only had to remove the dataoutput for windchill # since the dataoutput frequently changed at this # positon and i've found no way how to better filter # the html-file to get the correct values there. # I'll leave the commented 'print's below if you # want to check what's the output there. # # You can see this script in action at: # http://amazone.boerde.de/mrtg/ # ################################################### $this_host = "SUN4"; system("wget -q http://english.wunderground.com/global/stations/17060.html -O /export/home/mrtg/bin/weather/weather.tx t"); @Zeilen = (""); open(WETTER, "</export/home/mrtg/bin/weather/weather.txt") || die "Uh... file not found.\n"; while(<WETTER>) { chomp; if (/<td width="35%">Temperature/ .. /<td>Humidity/) { s/<[^>]*>/ /gs; s/°\;/ /gs; s/%/ /gs; push(@Zeilen,$_); } } $daten = join('', @Zeilen); @output = split(/\s+/, $daten); #$laenge_output = @output; #print "$laenge_output\n"; #print "@output\n"; #print "$output[0]\n"; #print "$output[1]\n"; #print "$output[2]\n"; #print "$output[3]\n"; #print "$output[4]\n"; #print "$output[5]\n"; print "$output[6]\n"; #print "$output[7]\n"; #print "$output[8]\n"; #print "$output[9]\n"; #print "$output[10]\n"; #print "$output[11]\n"; #print "$output[12]\n"; #print "$output[13]\n"; print "$output[14]\n"; close(WETTER); #print "0\n"; $uptime = `uptime`; $uptime =~ /up (.*?),/; $up = $1; print "$up\n"; print "$this_host\n"; *********************************************************** Cihan SUBASI Garanti Technology Internet ve Yazilim Hizmetleri Tel:(90)(212)4783426 GSM:(90)(533)(2750353) Fax:(90)(212)6576150 http://www.garantitechnology.com mailto:[EMAIL PROTECTED] Success is a wonderful thing, but never underestimate the value of failure. Failure teaches many more things than success ever can. *********************************************************** This message and attachments are confidential and intended solely for the individual(s) stated in this message.If you received this message although you are not the addressee you are responsible to keep the message confidential .The sender has no responsibility for the accuracy or correctness of the information in the message and its attachments.Our company shall have no liability for any changes or late receiving,loss of integrity and confidentiality,viruses and any damages caused in anyway to your computer system. Bu mesaj ve ekleri mesajda gonderildigi belirtilen kisi/kisilere ozeldir ve gizlidir.Bu mesajin muhatabi olmamaniza ragmen tarafiniza ulasmis olmasi halinde mesaj iceriginin gizliligi ve bu gizlilik yukumlulugune uyulmasi zorunlulugu tarafiniz icin de soz konusudur.Mesaj ve eklerinde yer alan bilgilerin dogrulugu ve guncelligi konusunda gonderenin ya da sirketimizin herhangi bir sorumlulugu bulunmamaktadir.Sirketimiz mesajin ve bilgilerinin size degisiklige ugrayarak veya gec ulasmasindan, butunlugunun ve gizliliginin korunamamasindan, virus icermesinden ve bilgisayar sisteminize verebilecegi herhangi bir zarardan sorumlu tutulamaz. -- Unsubscribe mailto:[EMAIL PROTECTED] Archive http://www.ee.ethz.ch/~slist/mrtg FAQ http://faq.mrtg.org Homepage http://www.mrtg.org WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
