在 cron globaly 中禁用邮件

Lao*_*neo 6 email linux sendmail cron

网络上充满了如何禁用 cron 中的邮件的建议,就像这里所问的那样,阻止 linux 向我发送 cron 错误?. 是否真的没有全局配置标志可以设置为所有用户和所有命令禁用 cron 中的邮件。我真的不想告诉所有用户你必须添加

MAILTO=""
Run Code Online (Sandbox Code Playgroud)

或者

<command> > /dev/null 2>&1
Run Code Online (Sandbox Code Playgroud)

到您的 crontab。

Gry*_*ius 9

根据手册页可以通过添加-m off到守护进程 args来禁用 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 (i.e., crond -m off) will disable the sending of mail.
Run Code Online (Sandbox Code Playgroud)

  • Ubuntu 默认使用 vixiecron,它没有这个选项,不幸的是,我也不确定 ubuntu 中的实际解决方案是什么,有人吗? (3认同)