qmailanalog¤Ç¤Ç¤¤ë¤³¤È †
qmailanalog¤Ë¤Ïmultilog¤«¤éÆÃÄê¤Î´ü´Ö¤ò¼è¤ê½Ð¤·¤Æ²òÀϤ¹¤ëµ¡Ç½¤Ï¤Ä¤¤¤Æ¤Ê¤¤¤Î¤ÇÊÌÅӰʲ¼¤Î¤è¤¦¤Ê¼ê½ç¤òƧ¤àɬÍפ¬¤¢¤ë
qmailanalog¥¤¥ó¥¹¥È¡¼¥ë †http://cr.yp.to/qmailanalog.html ¤«¤é qmailanalog-0.70.tar.gz ¤ò¥²¥Ã¥È # tar xvfz qmailanalog-0.70.tar.gz # cd qmailanalog-0.70 # make # make setup check /usr/local/qmailanalog ¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤ë qlogselect¤Î½àÈ÷ †# wget http://www.qcc.sk.ca/~charlesc/software/misc/qlogselect # chmod +x qlogselect # mv qlogselect /usr/local/qmailanalog/bin ¼Â¹Ô¥¹¥¯¥ê¥×¥È¤ÎºîÀ® †tai64n2tai ¥³¥Þ¥ó¥É¤¬¤Ê¤¤¤Î¤Ç http://untroubled.org/qlogtools/ ¤«¤é qlogtools-3.1.tar.gz ¤ò¥²¥Ã¥È¤¹¤ë # tar xvzf qlogtools-3.1.tar.gz # cd qlogtools-3.1 # make # mv tai64n2tai /usr/local/qmailanalog/bin # cd .. # rm -fr qlogtools-3.1* # vi /usr/local/qmailanalog/bin/analog.sh #!/bin/sh MAILTO=mailto@example.com MAILFROM=mailfrom@example.com export PATH="$PATH:/usr/local/qmailanalog/bin:/var/qmail/bin" tmpdir=/tmp/qmail-cron.$$.$RANDOM mkdir $tmpdir pushd $tmpdir >/dev/null s_year=`date -d '1 day ago' +%Y` s_month=`date -d '1 day ago' +%m` s_day=`date -d '1 day ago' +%d` e_year=`date +%Y` e_month=`date +%m` e_day=`date +%d` start="$s_year-$s_month-$s_day" end="$e_year-$e_month-$e_day" LOGDIR=/var/log/qmail cat "$LOGDIR"/{"@",cur}* \ | tai64n2tai \ | qlogselect start $start end $end \ | matchup >logfile 5>/dev/null for ana in zoverall zddist zdeferrals zfailures zrhosts zsuids zrxdelay; do echo "" >>result echo "-----------Result of $ana------------" >>result $ana 2>/dev/null <logfile >>result done rm -f logfile (echo "To: $MAILTO" echo "From: $MAILFROM" echo "Subject: mailstats for $s_year-$s_month-$s_day" echo "" cat result )| qmail-inject -f $MAILFROM rm -f result popd >/dev/null rm -rf $tmpdir 2Æü´Ö¤òÂоݤˤ¹¤ë¤Ê¤é¡Ö2 days ago¡×¡¢1½µ´Ö¤Ê¤é¡Ö1 week ago¡× # chmod +x /usr/local/qmailanalog/bin/analog.sh # /usr/local/qmailanalog/bin/analog.sh ¤Ç¥á¡¼¥ë¤¬ MAILTO °¸¤ËÆϤ±¤ÐOK crontab¤Ç¼Â¹Ô¤¹¤ë¤Ë¤Ï # crontab -e 30 4 * * * /usr/local/qmailanalog/bin/analog.sh 2>/dev/null |