#!/bin/sh
zfile=/tmp/maillog.tmp.$$
mygrep="grep" mygrepc="grep -c"
if [ "$1" = "-yesterday" ]
then shift;
command="zcat /var/log/maillog.0.gz"
else
command="cat /var/log/maillog"
fi
if [ "$1" = "" ]
then
stringtmp=""
else stringtmp=" $1: "
fi
$command | grep "$stringtmp" > $zfile
echo -n "CHKUSER entries "; $mygrepc CHKUSER $zfile
echo -n "CHKUSER accepted null senders "; $mygrepc \
"CHKUSER accepted null sender" $zfile
echo -n "CHKUSER rejected senders "; $mygrepc "CHKUSER rejected sender" $zfile
echo -n "CHKUSER accepted senders "; $mygrepc "CHKUSER accepted sender" $zfile
echo -n "CHKUSER rejected rcpts "; $mygrepc "CHKUSER rejected rcpt" $zfile
echo -n "CHKUSER accepted rcpts "; $mygrepc "CHKUSER accepted rcpt" $zfile
echo -n "CHKUSER rejected relaying "; $mygrepc "CHKUSER rejected relaying" $zfile
echo -n "CHKUSER accepted relaying "; $mygrepc "CHKUSER relaying rcpt" $zfile
echo -n "CHKUSER mbx overquota "; $mygrepc "CHKUSER mbx overquota" $zfile
echo -n "CHKUSER max rcpt intrusion triggers "; $mygrep \
"CHKUSER intrusion threshold" $zfile | $mygrepc "allowed rcpt"
echo -n "CHKUSER max wrong rcpt intrusion triggers "; $mygrep \
"CHKUSER intrusion threshold" $zfile | $mygrepc "allowed invalid rcpt"
echo -n "CHKUSER rejected intrusions "; $mygrepc "CHKUSER rejected intrusion" $zfile
rm -f $zfile