How to stop a cron job sending email

Erik Christiansen dvalin at internode.on.net
Fri Oct 31 11:15:18 UTC 2008


On Fri, Oct 31, 2008 at 10:58:22AM +0000, Chris Rees wrote:
> 2008/10/31 Johann Spies <jspies at sun.ac.za>:

> > # m h  dom mon dow   command
> > 0-59/5 * * * * /usr/local/bin/krypos
> >
> > $ cat /usr/local/bin/krypos
> > #!/bin/sh
> > killall fetchmail &> /dev/null
> > /usr/bin/fetchmail &> /dev/null
> >
> > I have also tried
> >
> > 0-59/5 * * * * /usr/local/bin/krypos &> /dev/null
> >
> > But I still get the email every 5 minutes.
> >
> > That did not happen on my old computer.
> >
> > How do I stop this?

> 
> The actual redirect should be 2>&1

Yes, or specify "#!/bin/bash" when using bashisms.

Alternatively, putting the line:

MAILTO=""

before any crontab actions has served me well to stop cron sending mail
in the first place, obviating the need to intercept it afterwards.

Erik

-- 
A computer is like an air conditioner, it stops working when you open Windows.
   - Seen in Matthias Apitz's sig, on mutt-users.





More information about the ubuntu-users mailing list