How to stop a cron job sending email
Karl Auer
kauer at biplane.com.au
Fri Oct 31 11:02:27 UTC 2008
On Fri, 2008-10-31 at 11:48 +0200, Johann Spies wrote:
> The same user crontabs (that run every 5 minutes) that were used on my
> old computer (Debian) now (on Ubuntu Hardy) produce an email for
> every run.
If a cron job produces output, any output at all, on stdout or stderr,
it will be sent to the root user by email. That means either that the
scripts themselves are producing an output they did not produce before,
or the redirection is not working, where it did work before.
How about letting us see one of those emails?
> Here is an example of one of them:
> #!/bin/sh
> killall fetchmail &> /dev/null
> /usr/bin/fetchmail &> /dev/null
I'm not familiar with that syntax ("&>"). If it's legal bash syntax, it
could be that it is one of the syntax subtleties NOT supported by dash,
the new /bin/sh shell.
If the cron output in the emails is truly innocent, and not a symptom of
some deeper problem, you could try the more standard syntax for
redirecting stdout and stderr to null and see if that helps:
killall fetchmail > /dev/null 2>&1
/usr/bin/fetchmail > /dev/null 2>&1
I'm curious though - why on earth are you killing and restarting
fetchmail every five minutes?!?
Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au) +61-2-64957160 (h)
http://www.biplane.com.au/~kauer/ +61-428-957160 (mob)
GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20081031/31d740c2/attachment.sig>
More information about the ubuntu-users
mailing list