Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#! /usr/bin/env bash
# generate previous days e-mail stats and send to postmaster alias
# NOTE: we cat mail.log.1 and mail.log to pick up anything after a log rotate
# then, pass the output to pflogsumm with the "yesterday" parameter, then use mailx
# to send it to the postmaster alias.
#
# will emit an error to stderr if mail.log.1 does not exist, in which case it will
# only get stats from mail.log
# This file (or a link) should be placed in /etc/cron.daily on a Debian system
cat /var/log/mail.log.1 /var/log/mail.log | pflogsumm -d yesterday 2>&1 |/usr/bin/mailx -s "`uname -n` daily mail stats" postmaster