Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 2003 11:48:17 -0600
From:      Charles Howse <chowse@charter.net>
To:        stuart.gibson@bridgeman.co.uk, freebsd-questions@freebsd.org
Subject:   Re: crontab
Message-ID:  <200311261148.17839.chowse@charter.net>
In-Reply-To: <3FC4D7D4.11526.C30C22@localhost>
References:  <3FC4D7D4.11526.C30C22@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 26 November 2003 10:41 am, stuart.gibson@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.)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311261148.17839.chowse>