Ubuntu – Disable daily anacron mail updates

anacroncronntp

Every day, I get the following mail delivered by postfix:

From: Anacron <root@name.domain>
To: root@name.domain
Subject: Anacron job 'cron.daily' on name
Content-Type: text/plain; charset=US-ASCII
Message-Id: <20130708082739.88AE83A3F72@name.domain.domain>
Date: Mon,  8 Jul 2013 10:27:39 +0200 (CEST)

/etc/cron.daily/ntpdate:
 8 Jul 10:27:39 ntpdate[4617]: step time server 85.254.216.1 offset -1.454673 sec

However, I'd like to limit anacron to only warn me if something is wrong. Is there any way to accomplish this?
I could change the anacrontab file to send all mails to /dev/null, but then I'd get no warning mails whatsoever.

Is there a better way to control the granularity of anacron status updates?

Best Answer

Anacron sends emails only if cron jobs produce some output. If you are not interested in some of the messages you need to filter it yourself by modifying appropriate script in one of /etc/cron.* (i.e. /etc/cron.daily/) directories.

If you don't want to see updates from /etc/cron.daily/ntpdate - edit the file and redirect standard output of command to /dev/null or better to a log file because you may want to check it in the future or do some custom filtering that would suite you. If you want to be notified about some erroneous conditions you should probably not redirect standard error stream, so it can be included in cron email report.

Related Question