Subversion Repositories sysadmin_scripts

Rev

Rev 72 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
72 rodolico 1
#! /usr/bin/env bash
2
 
3
# generate previous days e-mail stats and send to postmaster alias
4
# NOTE: we cat mail.log.1 and mail.log to pick up anything after a log rotate
5
# then, pass the output to pflogsumm with the "yesterday" parameter, then use mailx
6
# to send it to the postmaster alias.
7
#
8
# will emit an error to stderr if mail.log.1 does not exist, in which case it will
9
# only get stats from mail.log
10
 
11
# This file (or a link) should be placed in /etc/cron.daily on a Debian system
12
 
13
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
14