| Cheshire Cat Computing http://www.steveshipway.org/forum/ |
|
| Graphprune.pl not working from a cron job http://www.steveshipway.org/forum/viewtopic.php?f=2&t=467 |
Page 1 of 1 |
| Author: | guardian46w [ Tue Jan 25, 2005 10:30 am ] |
| Post subject: | Graphprune.pl not working from a cron job |
When i run graphprune.pl at the prompt (exactly as it is in the script file below), I get messages like this: [root@hnb-monitor root]# perl /home/mrtg/conf/graphprune.pl Info: Cleaned up 349 file(s) in graphs directory. Info: Cleaned up 0 old archive graph(s) But everyday after the cron job I get an email to root with this message: /etc/cron.daily/graphprune: Illegal division by zero at /etc/cron.daily/graphprune line 10. Here is my cron script (/etc/cron.daily/graphprune): #!/usr/bin/perl perl /home/mrtg/conf/graphprune.pl (this is line 10, there are comments above it). These are the file permissions: -rwxr-xr-x 1 root root 212 Jan 21 12:16 graphprune (/etc/cron.daily) -rwxr-xr-x 1 root root 3812 Jan 10 14:31 graphprune.pl (/home/mrtg/conf) -r-xr-xr-x 1 root root 238131 Nov 24 08:15 routers2.cgi (/var/www/cgi-bin) -rw-rw-r-- 1 root root 22391 Jan 21 10:32 routers2.conf(/home/mrtg/conf) Here are the configurable lines from graphprune.pl: my( $conffile ) = "/home/mrtg/conf/routers2.conf"; my( $archmaxage ) = 0; My routers2.conf file has these lines: [graphprune] # number of days after which to delete archived graphs archmaxage = 0 This is a WhiteBox 3.0 respin1 Linux install, perl is 5.8.0. This isn't a big problem, but it would be nice to find out why it's doesn't seem to work from the cron job. (Especially, since I tend to forget to do the clean up manually). Any help would be appreciated. THX Gene White |
|
| Author: | stevesh [ Tue Jan 25, 2005 10:43 am ] |
| Post subject: | |
This is your problem: #!/usr/bin/perl perl /home/mrtg/conf/graphprune.pl Your are using a #! line specifying that this is a perl script, but in fact it is a shell script that calls a perl script (graphprune.pl is pa perl script, you have written a shellscript). Try this: #!/bin/sh /usr/bin/perl /home/mrtg/conf/graphprune.pl (You may need to modify the paths for /bin/sh and /usr/bin/perl depending on your system). The 'divide by zero' error came from perl, which thought you wanted to divide 'home' by 'mrtg' when it saw home/mrtg. |
|
| Author: | guardian46w [ Wed Jan 26, 2005 6:17 am ] |
| Post subject: | |
DUH!!! Wow, I sure missed that one! Thanks Steve. |
|
| Page 1 of 1 | All times are UTC + 12 hours [ DST ] |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|