crontab
Kevin D. Kinsey, DaleCo, S.P.
kdk at daleco.biz
Wed Nov 26 11:30:29 PST 2003
Chris wrote:
> Kevin D. Kinsey, DaleCo, S.P. wrote:
>
>> 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?
>>>
>>> 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.
>
>
> Very cool! Now, what if you do the same, but instead of the normal
> crons, can something like this be done with the /etc/periodic/daily,
> weekly, and monthly routines?
>
I'd suggest
$man periodic
and see the relevant paragraphs under "Examples"...
KDK
More information about the freebsd-questions
mailing list