Crontab going crazy

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,516
Location
A Coruña, Spain
Hi guys,

im going into a strange problem, i use to use mrtg on all my box for check system works.. but... on 2 box now (dunno why) cron in syslog is execute but page dont get updated, if i copy/paste the command from crontab into command line, it work and page get updated...

Same command line in crontab on the 3rd box work perfectly...

Any suggestion?

Thanks
 
Can't tell without seeing the cronjob line and perhaps any error messages.

Jeff
 
Code:
*/5 * * * * /usr/local/mrtg-2/bin/mrtg /home/admin/domains vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg --logging /var/log/mrtg.log >/dev/null 2>&1

/var/log/syslog show that he do the command, i thot about snmpd thats why ive pasted too but, the csf config is the same for all 3 box
Code:
Feb  1 08:25:01 Vitesse /USR/SBIN/CRON[7522]: (root) CMD (/usr/local/mrtg-2/bin/mrtg
/home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg --logging /var/log/mrtg.log >/dev/null 2>&1)
Feb  1 08:25:02 Vitesse snmpd[2778]: Connection from UDP: [81.174.67.21]:55361

/var/log/mrtg.log show only when i started last night manually for test
Code:
2010-01-31 23:32:40 -- Started mrtg with config '/home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg'
2010-01-31 23:52:12 -- Started mrtg with config '/home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg'
2010-02-01 00:01:34 -- Started mrtg with config '/home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg'
2010-02-01 00:02:56 -- Started mrtg with config '/home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg'
2010-02-01 00:19:48 -- Started mrtg with config '/home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg'
2010-02-01 00:20:03 -- Started mrtg with config '/home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg'
2010-02-01 00:20:33 -- Started mrtg with config '/home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg'
2010-02-01 00:31:18 -- Started mrtg with config '/home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg'


Thanks
 
Code:
*/5 * * * * /usr/local/mrtg-2/bin/mrtg /home/admin/domains vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg --logging /var/log/mrtg.log >/dev/null 2>&1
The firwet thing I'd check is for the missing / character; you've got a space between domains and vitesse.creazynetwork.it/public_html.

You can also remove the error redirection if you need to so the cronjob will send you any error messages.

Jeff
 
sorry that was a copy/paste error, is crontab is correct is just a long line so i copied manually, the logging of mrtg got no update, how can i make that cron send email to a specify email address so i can check?

thanks for ur help
 
The cronjob should send any output to the user under which it runs. If it's running as root, make sure you've redirected root email to real user.

This is what you need to remove if you want the output sent to you:
Code:
>/dev/null 2>&1

Jeff
 
Yeah pipe it to the mail or mailx command.

If you want all crons to go to a certain email you can use in your cron file:

Code:

Or else just use this:

Code:
*/5 * * * * /usr/local/mrtg-2/bin/mrtg /home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg --logging /var/log/mrtg.log | mail -s 'subject' [email][email protected][/email]
 
Last edited:
omg finally!

ERROR: Mrtg will most likely not work properly when the environment
variable LANG is set to UTF-8. Please run mrtg in an environment
where this is not the case. Try the following command to start:

env LANG=C /usr/local/mrtg-2/bin/mrtg /home/admin/domains/vitesse.crazynetwork.it/public_html/MRTG/core/mrtg.cfg --logging /var/log/mrtg.log


but i dont get why on command line it work, ive just to add env LANG=C before the command line in cron right?
 
Maybe not as crazy as we'd think at first glance; cronjobs do not run in the same environment as logged-in users. That's why we need complete paths in cronjobs.

Jeff
 
Back
Top