禁用邮件在cron globaly

networking充满了build议如何禁用邮件在cron就像问这里停止从电子邮件发送cron错误的Linux? 。 是否真的没有全局configuration标志,我可以设置禁用邮件在所有用户和所有命令的cron。 我真的不想告诉所有用户你必须添加

MAILTO="" 

要么

 <command> > /dev/null 2>&1 

到你的crontab。

根据手册页可以通过添加-m off守护进程参数禁用cron邮件参数

  -m This option allows you to specify a shell command to use for sending Cron mail output instead of using sendmail(8) This command must accept a fully formatted mail message (with headers) on stan‐ dard input and send it as a mail message to the recipients specified in the mail headers. Specify‐ ing the string off (ie, crond -m off) will disable the sending of mail.