1

I'm a newbie in server administration (centos 7) and have a problem with email notifications from the cron. There is 1 cron job.

15 * * * * user cd /var/www/domain/public_html/cron && php -d error_reporting="E_ALL & ~E_NOTICE" cron.php

and I set MAILTO in order to be notified about errors. But cron daemon sends me multiple emails every hour or two (also with previous cron errors). Then I wanted to disable email notifications completely so set MAILTO="" but still receiving messages. Probably there is a problem with mail or cron log. Permission denied after trying to clear maillog.

sudo > /var/log/maillog

Any suggestion what to do in order to receive only one email for the cron job?

4
  • Are you cron jobs fireing more than once as well by any chance? Check for /etc/anacrontab as you may be running both & that maybe why you get duplicate emails. I can otherwise tell you how to suppress errors from individual cron jobs if you want Commented Apr 3, 2017 at 17:21
  • I haven't touched anacrontab so it shouldn't be the reason... The problem must be somewhere in logs or general cron settings because I'm receiving old errors for old cron jobs, not duplicate messages. Commented Apr 4, 2017 at 9:50
  • from how long ago are these old jobs, and what do the email headers say ? You need to give us some more details please Commented Apr 4, 2017 at 16:36
  • Seems to be answered here: serverfault.com/questions/226074/cron-only-get-errors-in-emails Commented May 4 at 19:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.