Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 2003 11:47:51 -0600
From:      "Kevin D. Kinsey, DaleCo, S.P." <kdk@daleco.biz>
To:        stuart.gibson@bridgeman.co.uk
Cc:        freebsd-questions@freebsd.org
Subject:   Re: crontab
Message-ID:  <3FC4E747.2000503@daleco.biz>
In-Reply-To: <3FC4D7D4.11526.C30C22@localhost>
References:  <3FC4D7D4.11526.C30C22@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
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?
>
>regards
>
>Stuart Gibson
>
>  
>

Sure!


Redirect stderror to /dev/null:

/bin/sh /home/me/myscript > /dev/null

And this one won't mail you, whether it errors
or not....

 /bin/sh /home/me/myscript > /dev/null 2>&1


Kevin Kinsey
DaleCo, S.P.



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