3 # $FreeBSD: src/etc/periodic/daily/460.status-mail-rejects,v 1.16 2003/11/07 21:55:35 ru Exp $
4 # $DragonFly: src/etc/periodic/daily/460.status-mail-rejects,v 1.3 2004/11/15 08:11:59 joerg 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
56 egrep -e "^$start.*ruleset=check_[^[:space:]]+,[[:space:]]+arg1=(<[^@]+@)?([^>,]+).*reject=.*" |
57 sed -e 's/.*arg1=//' -e 's/.*@//' -e 's/[>[:space:]].*$//' |
58 sort -f |
uniq -ic |
sort -fnr |
tee /dev
/stderr |
wc -l)