I have 3 jobs in my crontab. I want to recieve emails if only 1 of them fails and not for other two. Is there any way to restric emails to one type of cronjob?
+3
A:
Redirect the output of the two you don't care about to /dev/null
if you don't ever want to see the output or to some file if you do.
Blrfl
2010-10-13 15:20:06
And the standard error.
mobrule
2010-10-13 15:31:23
A:
Your cron likely supports this:
# This job produces mail.
* * * * * echo Hello
# These jobs do not.
MAILTO=
* * * * * echo Foo
* * * * * echo Bar
Mark Edgar
2010-10-14 07:18:48
Isn't MAILTO= common to all the task in a same crontab file? If the first task produces the email where is the email id specified for that job? I thought MAILTO= is common to all the tasks in crontab file? Or can we have multiple MAILTO='s in a crontab file?
Fonda
2010-10-14 14:10:29