diff options
author | brian <brian@FreeBSD.org> | 2000-06-30 09:41:16 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2000-06-30 09:41:16 +0000 |
commit | d220ee616b59011be838749e52cca2a90d3b658d (patch) | |
tree | a2bfa16b388553c79c6ad9cfdf9e9158cf97c51f /etc/periodic | |
parent | 97d1a2bb34b02efdd2f7fb3a02bb615218678d50 (diff) | |
download | FreeBSD-src-d220ee616b59011be838749e52cca2a90d3b658d.zip FreeBSD-src-d220ee616b59011be838749e52cca2a90d3b658d.tar.gz |
Add $daily_status_mail_rejects_logs, defaulting to 3 to control
how many /var/log/maillog* files to check
PR: 19587
Diffstat (limited to 'etc/periodic')
-rwxr-xr-x | etc/periodic/daily/460.status-mail-rejects | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/etc/periodic/daily/460.status-mail-rejects b/etc/periodic/daily/460.status-mail-rejects index 43bdf7d..cfe4213 100755 --- a/etc/periodic/daily/460.status-mail-rejects +++ b/etc/periodic/daily/460.status-mail-rejects @@ -13,13 +13,22 @@ fi case "$daily_status_mail_rejects_enable" in [Yy][Ee][Ss]) - if [ -d /etc/mail -a -f /var/log/maillog ] + if [ -d /etc/mail -a -f /var/log/maillog -a \ + "$daily_status_mail_rejects_logs" -gt 0 ] then echo echo Checking for rejected mail hosts: start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'` - zcat -fc /var/log/maillog.0* /var/log/maillog | + n=$(($daily_status_mail_rejects_logs - 2)) + { + while [ $n -ge 0 ] + do + [ -f /var/log/maillog.$n* ] && zcat -fc /var/log/maillog.$n* + n=$(($n - 1)) + done + cat /var/log/maillog + } | perl -ne "print \"\$2\n\" if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" | sort | uniq -c | sort -nr |