0

I configured email subsystem of my Centos 7 so it sends emails to outside world. Since then I started receiving about 10 emails every minutes from crond process. It is useless for me and want crond not to send any emails.

I tried to set

MAILTO="" 

in /etc/crontab and in /etc/crontab.d (there's no more MAILTO=root in crontab related files) but the emails are still coming. I restarted crond service and later I restarted whole system. Nothing helps so far.

3

Add the following to /etc/sysconfig/crond and then restart crond. This will send the outputs to syslog instead of mail:

CRONDARGS="-s -m off"

  • thats what I was looking for. it didn't come to my mind, that theres another cron config file under sysconfig. Logging is much better than mailing, suppose dedicated cron.log would be nicer – Pavel Niedoba Aug 29 '17 at 13:50
0

If you don't want to receive any emails from running cron jobs, you can redirect stdout and stderr to /dev/null or to some log file.

command > /dev/null 2>&1

You can still redirect stdout to a log file and stderr to /dev/null if needed.

  • I know about this one, but we have many crontabs under different users so I prefer one "final solution" to this problem – Pavel Niedoba Aug 29 '17 at 13:45
  • @PavelNiedoba: You did not say that explicitly in your question. – Khaled Aug 29 '17 at 13:51

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.