1. 程式人生 > >Disable The Mail Alert By Crontab Command On a Linux or Unix-like Systems

Disable The Mail Alert By Crontab Command On a Linux or Unix-like Systems

自從安裝好 postfix 後,發現 root 帳號會有很多信進來,原來是 crontab 會寄信!

解法:

You can set the MAILTO variable in your crontab.

Just type the following at the top of your crontab (crontab -e):

MAILTO=""

and cron will not send any mail for any of the jobs. If you have to disable mails for a specific task, use the following:

@hourly /path/to/script.sh >/dev/null 2>&1