Howdy folks,

I'm using a script (found on this list, although I don't have the
original auythor handy) to automate stat's analysis. The script sits in
cron, and is run daily.

#!/bin/sh
#
# Mail all the qmail stats out someplace sensible.
#
RAWLOG=/tmp/qmail.$$.raw
STATSPROGS="zoverall zdeferrals failures zsuccesses zrecipients zrhosts
zrxdelay zsenders zsuids zddist"
# comma space seperate all email addresses
RECIPIENTS="[EMAIL PROTECTED]"
#
cat <<EOF >/tmp/qmail.$$.comp
X-Mailer: /bin/cat v1.0
To: $RECIPIENTS
Subject: Qmail logs for `hostname`
--------
EOF
# Munge the logs into an intermediary format.
awk '{$1="";$2="";$3="";$4="";$5="";print}' < /var/log/maillog \
        | /usr/local/qmailanalog/bin/matchup > $RAWLOG
for i in $STATSPROGS; do
        /usr/local/qmailanalog/bin/$i < $RAWLOG >/tmp/qmail.$$.$i
        echo "#text/plain [$i] /tmp/qmail.$$.$i" >> /tmp/qmail.$$.comp
done
echo send | comp -use -edit mhn -file /tmp/qmail.$$.comp >/dev/null
# Must use leading "*", as mh renames things to "delete" them...
rm -f /tmp/*qmail.$$.*

It's been working fine for many months now. A few days ago, it started
producing the error "
matchup: fatal: unable to write fd 5: file descriptor not open". The
stat's are still produced, however. The 3rd Stat's program (failures)
doesn't produce any output, but that could simply be because there was
no failures?

- Tillman Hodgson

Reply via email to