LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Cron: E-Mail me only when necessary (https://www.linuxquestions.org/questions/linux-general-1/cron-e-mail-me-only-when-necessary-22223/)

elconde 05-31-2002 12:59 AM

Cron: E-Mail me only when necessary
 
I have written a shell script that I have Cron execute every hour. Cron e-mails me every hour when the script is executed. I would prefer it to e-mail me only when my script returns a non-zero exit status.

How should I go about doing this?


TIA,

Robert

piranha 05-31-2002 04:07 AM

put >/dev/null behind the command

elconde 05-31-2002 08:52 AM

Ah, so simple.


Thanks!

elconde 05-31-2002 09:40 AM

OK, so my crontab looks like this:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.16401 installed on Fri May 31 09:49:31 2002)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
SHELL=/bin/tcsh
0 5 * * * /root/Cron/backup > /dev/null
5 * * * * /root/Cron/earlybird > /dev/null


but I'm still getting e-mails every hour. Did I do it right?


-R


All times are GMT -5. The time now is 03:46 PM.