crontab

Charles Howse chowse at charter.net
Wed Nov 26 09:53:14 PST 2003


On Wednesday 26 November 2003 10:41 am, stuart.gibson at bridgeman.co.uk wrote:
> Hi,
>
> I have a number of scripts that run every night using a crontab.  In my
> crontab file I'm using the MAILTO flag to get cron to email me every
> time it runs which results in a lot of emails.
>
> Is there any way of instructing cron to only email me if the cron job
> fails?

By default, cron will email you whatever would be shown on the terminal when 
the script runs.
The way I get around this is to redirect the stdout of the script to /dev/
null.
Like this:
0 0 * * * /root/bin/myscript.sh > /dev/null

-- 
Thanks,
Charles
http://howse.homeunix.net:8080

Random Murphy's Law:
All general statements are false.  (Think about it.)



More information about the freebsd-questions mailing list