6

The web is full of suggestions how to disable mailing in cron like asked here stop linux from emailing me cron errors?. Is there really no global config flag I can set to disable mailing in cron for all users and all commands. I really don't want to tell all users you have to add

MAILTO=""

or

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

to your crontab.

3
  • 1
    this is very common way to do, you can also disable sendmail|postfix.
    – alexus
    Mar 14, 2014 at 15:09
  • 1
    In my experience, disabling sendmail causes the mail to build up in the queue. Not sending mail in the first place is the most ideal solution. Jul 22, 2015 at 15:52
  • for centos this is the way to do it: serverfault.com/questions/871039/… Sep 5, 2017 at 8:51

1 Answer 1

9

according to the man page can disable cron mail by adding -m off to the daemon args

   -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.
5
  • Nice one. On Ubuntu where can i define the daemon args?
    – Laoneo
    Mar 14, 2014 at 15:09
  • I'm no ubuntu/upstart expert. I guess you'd have to change in /etc/init/cron.conf or add in /etc/init/cron.override, see init manpage
    – Gryphius
    Mar 14, 2014 at 15:32
  • 3
    Ubuntu uses vixiecron by default which does not have this option, unfortunately I am also unsure about what is the actual solution for this in ubuntu, anyone? Mar 17, 2014 at 12:24
  • @Onitlikesonic As far as I'm aware there's no way to globally disable cron emails in Vixie cron - you may be out of luck unless you're willing to change your cron daemon (which is probably the easiest solution)...
    – voretaq7
    Mar 18, 2014 at 16:46
  • 1
    @Onitlikesonic See askubuntu.com/questions/435454/…
    – augurar
    Sep 20, 2017 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .