[mrtg] Re: mrtg doesn't work from crontab
Castle, Shane
scastle at co.boulder.co.us
Thu Jan 12 20:10:24 MET 2006
I suspect the problem is LD_LIBRARY_PATH not being the same
for cron as for the user. Cron imposes more restrictions
on the environment, see man cron, and depending on your running
OS (you don't mention this at all) this can be tuned by tweaking
various knobs. For Solaris, for instance, I have done this:
(assume one long line)
# run MRTG every 5 min
0,5,10,15,20,25,30,35,40,45,50,55 * * * *
LD_LIBRARY_PATH=/usr/local/lib:/opt/sfw/lib:/usr/sfw/lib:/lib:/usr/lib
/usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/conf/unix.cfg 2>&1
>/dev/null
Other OSes may allow you to set LD_LIBRARY_PATH for cron elsewhere.
--
Shane Castle
-----Original Message-----
From: mrtg-bounce at list.ee.ethz.ch [mailto:mrtg-bounce at list.ee.ethz.ch]
On Behalf Of adam-green at ntlworld.com
Sent: Thursday, January 12, 2006 11:41
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] mrtg doesn't work from crontab
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