我知道crontab作业会将作业的输出通过电子邮件发送给用户。在我的crontab文件中,我有多个工作,如:
10 21 * * * test1.sh
13 21 * * * test2.sh
0 * * * * test3.sh
我不想收到test3.sh的电子邮件。下面的代码有效吗?我想确保只为最后一份工作我不会收到电子邮件。
10 21 * * * test1.sh
13 21 * * * test2.sh
MAILTO=""
0 * * * * test3.sh
答案 0 :(得分:4)
请参阅http://www.cyberciti.biz/faq/disable-the-mail-alert-by-crontab-command/
您可以使用类似
的内容0 * * * * test3.sh >/dev/null 2>&1
没有输出 - >没有邮件发送。