3 # $FreeBSD: src/etc/periodic/daily/460.status-mail-rejects,v 1.20 2005/01/12 01:31:21 brian Exp $
4 # $DragonFly: src/etc/periodic/daily/460.status-mail-rejects,v 1.4 2007/12/29 21:44:44 matthias Exp $
7 # If there is a global system configuration file, suck it in.
9 if [ -r /etc
/defaults
/periodic.conf
]
11 .
/etc
/defaults
/periodic.conf
15 case "$daily_status_mail_rejects_enable" in
19 echo '$daily_status_mail_rejects_enable is set but /etc/mail' \
22 elif [ ! -f /var
/log
/maillog
]
24 echo '$daily_status_mail_rejects_enable is set but ' \
25 "/var/log/maillog doesn't exist"
27 elif [ "$daily_status_mail_rejects_logs" -le 0 ]
29 echo '$daily_status_mail_rejects_enable is set but ' \
30 '$daily_status_mail_rejects_logs is not greater than zero'
34 echo Checking
for rejected
mail hosts
:
36 start
=`date -v-1d '+%b %e'`
37 n
=$
(($daily_status_mail_rejects_logs - 2))
41 if [ -f /var
/log
/maillog.
$n ]
43 cat /var
/log
/maillog.
$n
44 elif [ -f /var
/log
/maillog.
$n.gz
]
46 zcat
-fc /var
/log
/maillog.
$n.gz
47 elif [ -f /var
/log
/maillog.
$n.bz2
]
49 bzcat
-fc /var
/log
/maillog.
$n.bz2
55 sed -n -E "s/^$start"'.*ruleset=check_[^ ]+, +arg1=<?([^@]+@)?([^>,]+).*reject=([^ ]+) .* ([^ ]+)$/\2 (\3... \4)/p' |
56 sort -f |
uniq -ic |
sort -fnr |
tee /dev
/stderr |
wc -l)