[mrtg] mrtg, cron and exim problem...

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Mon Dec 1 15:52:57 CET 2008


----- Original Message ----- 
From: "Jakub M" <burakozol at gmail.com>
To: "MRTG list" <mrtg at lists.oetiker.ch>
Sent: Monday, December 01, 2008 3:38 PM
Subject: [mrtg] mrtg, cron and exim problem...


>I have noticed a problem at junction of MRTG, cron and exim, so mot
> 'pure' mrtg problem, but you might know the solution. I receive on a
> local mail regularly informations:
>
> /bin/sh: -c: line 0: syntax error near unexpected token `then'
> /bin/sh: -c: line 0: `root      if [ -x /usr/bin/mrtg ] && [ -r
> /etc/mrtg/mrtg-vlan-traffic.cfg ]; then env LANG=C /usr/
> bin/mrtg /etc/mrtg/mrtg-vlan-traffic.cfg >> /var/log/mrtg/mrtg.log 2>&1; 
> fi'
>
> that is send by Cron Daemon. But the line is a original line that
> should run MRTG and normally, when I try it in a command line, it
> works. Do you have any Idea what's going on?


When you run the command on the command line, you may be using another shell 
and/or other settings.

Perhaps cron handles '&&' different from what you expect.

Try creating a small script. The 1st line contains "#!/bin/bash" (use the 
shell you're using, and adjust its path if necessary).

Put the command in that script and run the script from cron. Does that work? 



More information about the mrtg mailing list