[mrtg] Re: mrtg doesn't work from crontab

PAUL WILLIAMSON pwilliamson at mandtbank.com
Thu Jan 12 20:13:15 MET 2006


How about trying adding a shell to the command and putting the commands
into a shell script?

*/5 * * * * bash /path/to/bash/script

script:

/usr/local/bin/mrtg /usr/home/adam/mrtg/cfg/mrtg.cfg --logging
/var/log/mrtg.log

Just make it executable and add your magic line at the top and you're
all set!

Paul

>>> <adam-green at ntlworld.com> 01/12/06 1:41 PM >>>
Dear All,

I am having trouble running mrtg with cron and I'd really appreciate
some input.  I'm using mrtg 2.12.2 and perl 5.8.7 It works without
problems from the command line and this is the line I've added to the
crontab:

# MRTG every 5 minutes
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/mrtg
/usr/home/adam/mrtg/cfg/mrtg.cfg --logging /var/log/mrtg.log


I've read some other suggestions for fixing this.  I have tried adding
a user to this function call in the crontab; both as a user and root.  I
have tried including a cd/ temp too and of course checking the logs. 
The only real clue is the emails being sent to whoevers inbox it is. 
There are three flavors:

Message 2464:
Date: Thu, 12 Jan 2006 17:00:01 GMT
Subject: Cron <adam at monitor> operator /usr/libexec/save-entropy
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin>
X-Cron-Env: <HOME=/home/adam>
X-Cron-Env: <LOGNAME=adam>
X-Cron-Env: <USER=adam>

operator: not found

Message 2465:
Date: Thu, 12 Jan 2006 17:05:01 GMT
Subject: Cron <adam at monitor> root    /usr/libexec/atrun
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin>
X-Cron-Env: <HOME=/home/adam>
X-Cron-Env: <LOGNAME=adam>
X-Cron-Env: <USER=adam>

root: not found

Message 2466:
Date: Thu, 12 Jan 2006 17:05:01 GMT
Subject: Cron <adam at monitor> adam cd /temp
usr/local/bin/mrtg/usr/home/adam/mrtg/cfg/mrtg.cfg --logging
/var/log/mrtg.log
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin>
X-Cron-Env: <HOME=/home/adam>
X-Cron-Env: <LOGNAME=adam>
X-Cron-Env: <USER=adam>

Kind Regards
Adam Green

-----------------------------------------
Email sent from www.ntlworld.com 
Virus-checked using McAfee(R) Software 
Visit www.ntlworld.com/security for more information

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe 
Archive     http://lists.ee.ethz.ch/mrtg 
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org 
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi 



--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the mrtg mailing list