I have SpamAssassin with Amavid-new on my Debian Etch server acting as filtering for spam and viruses (along with ClamD).
Every few hours, I receive an email such as this (to root):
From: root@xxxx (Cron Daemon)
To: amavis@xxxx
Subject: Cron <amavis@fry> test -e /usr/sbin/amavisd-new-cronjob && /usr/sbin/amavisd-new-cronjob sa-sync
bayes: synced databases from journal in 1 seconds: 1751 unique entries (3454 total entries
It gets annoying fast.
As I’ve found in Debian bugs list, they’re not 100% sure as how to resolve this issue, being not clearly a bug but rather a communication problem (should we inform the user or not).
Tuomas Jormola came up with an elegant patch that does not redirect the wrongly behaving script to /dev/null, but instead filters it. If it’s the sync message, it removes it, otherwise the message is passed on and will get emailed to root via cron, effectively keeping the ability of reporting errors and problems to the administrators.
To fix it, I opened /usr/sbin/amavisd-new-cronjob, and replaced line 32 (right after “sa-sync”) that was this:
do_amavis_cmd "/usr/bin/sa-learn --sync >/dev/null"
to this:
do_amavis_cmd "/usr/bin/sa-learn --sync 2>&1 | egrep -v '^bayes: synced databases from journal in [0-9]+ seconds: [0-9]+ unique entries \([0-9]+ total entries\)$'"