Bug#476541: exim4-base: please handle nearly-empty logfile in daily cronjob stats
Marc Haber
mh+debian-packages at zugschlus.de
Sun Apr 20 20:41:10 UTC 2008
On Sun, Apr 20, 2008 at 04:21:38PM -0400, Justin Pryzby wrote:
> On Sun, Apr 20, 2008 at 09:34:04PM +0200, Marc Haber wrote:
> > On Thu, Apr 17, 2008 at 08:41:52AM -0400, Justin Pryzby wrote:
> > > That's probably due to very low mail volume on this laptop machine, in
> > > combination with an earlier logfile rotation.
> >
> > Please try the following patch against the daily cron job:
> Hi Marc,
>
> I don't think that helps or changes the situation at all.
>
> . eximstats generates an empty email, rather than either no mail at
> all, or an email that says just: "no mail activity in this
> interval".
I see. How about this:
--- debian/exim4-base.cron.daily (revision 2158)
+++ debian/exim4-base.cron.daily (working copy)
@@ -35,10 +34,17 @@
# Patches for more sophisticated processing are appreciated via the
# Debian BTS.
+E4BCD_MAINLOG_NOISE="^[[:digit:][:space:]:-]\{20\}\(\(Start\|End\) queue run: pid=[[:digit:]]\+\|exim [[:digit:]\.]\+ daemon started: pid=[[:digit:]]\+, .*\)$"
+
if [ -n "$E4BCD_DAILY_REPORT_TO" ]; then
if [ -x "$(command -v eximstats)" ] && [ -x "$(command -v mail)" ]; then
- < /var/log/exim4/mainlog eximstats $E4BCD_DAILY_REPORT_OPTIONS \
- | mail $E4BCD_DAILY_REPORT_TO -s"$(hostname --fqdn) Daily email activity report"
+ if [ "$(< /var/log/exim4/mainlog grep -v "$E4BCD_MAINLOG_NOISE" | wc -l)" -gt "0" ]; then
+ < /var/log/exim4/mainlog grep -v "$E4BCD_MAINLOG_NOISE" \
+ | eximstats $E4BCD_DAILY_REPORT_OPTIONS \
+ | mail $E4BCD_DAILY_REPORT_TO -s"$(hostname --fqdn) Daily e-mail activity report"
+ else
+ echo "no mail activity in this interval" \
+ | mail $E4BCD_DAILY_REPORT_TO -s"$(hostname --fqdn) Daily e-mail activity report"
else
echo "The exim4 cron job is configured to send a daily report, but eximstats"
echo "and/or mail cannot be found. Please check and make sure that these two"
@@ -54,7 +60,7 @@
fi
}
(please apply manually, I had to zap a hunk of irrelevant changes from
the output of svn diff)
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190
More information about the Pkg-exim4-maintainers
mailing list