Multiple crontab jobs, but only one of them should not send email… here is a solution to the problem.
Multiple crontab jobs, but only one of them should not send email
I know that a crontab job emails the output of the job to its users. In my crontab file, I have multiple jobs, for example:
10 21 * * * test1.sh
13 21 * * * test2.sh
0 * * * * test3.sh
I don’t want to receive emails about test3.sh. Does the code below work? I want to make sure that there is only one last job and I don’t get emails.
10 21 * * * test1.sh
13 21 * * * test2.sh
MAILTO=""
0 * * * * test3.sh
Solution
See also http://www.cyberciti.biz/faq/disable-the-mail-alert-by-crontab-command/
You can use something similar
0 * * * * test3.sh >/dev/null 2>&1
There will be no output –> No mail sent.