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

Posted in :

自從安裝好 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

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *