460.status-mail-rejects (140096) | 460.status-mail-rejects (175153) |
---|---|
1#!/bin/sh 2# | 1#!/bin/sh 2# |
3# $FreeBSD: head/etc/periodic/daily/460.status-mail-rejects 140096 2005-01-12 01:31:21Z brian $ | 3# $FreeBSD: head/etc/periodic/daily/460.status-mail-rejects 175153 2008-01-08 07:22:43Z dds $ |
4# 5 6# If there is a global system configuration file, suck it in. 7# 8if [ -r /etc/defaults/periodic.conf ] 9then 10 . /etc/defaults/periodic.conf 11 source_periodic_confs 12fi 13 | 4# 5 6# If there is a global system configuration file, suck it in. 7# 8if [ -r /etc/defaults/periodic.conf ] 9then 10 . /etc/defaults/periodic.conf 11 source_periodic_confs 12fi 13 |
14case "$daily_status_mail_rejects_shorten" in 15[Yy][Ee][Ss]) 16 sed_output='\4 \3...';; 17*) 18 sed_output='\2 (\3... \4)';; 19esac 20 |
|
14case "$daily_status_mail_rejects_enable" in 15 [Yy][Ee][Ss]) 16 if [ ! -d /etc/mail ] 17 then 18 echo '$daily_status_mail_rejects_enable is set but /etc/mail' \ 19 "doesn't exist" 20 rc=2 21 elif [ ! -f /var/log/maillog ] --- 24 unchanged lines hidden (view full) --- 46 elif [ -f /var/log/maillog.$n.bz2 ] 47 then 48 bzcat -fc /var/log/maillog.$n.bz2 49 fi 50 n=$(($n - 1)) 51 done 52 cat /var/log/maillog 53 } | | 21case "$daily_status_mail_rejects_enable" in 22 [Yy][Ee][Ss]) 23 if [ ! -d /etc/mail ] 24 then 25 echo '$daily_status_mail_rejects_enable is set but /etc/mail' \ 26 "doesn't exist" 27 rc=2 28 elif [ ! -f /var/log/maillog ] --- 24 unchanged lines hidden (view full) --- 53 elif [ -f /var/log/maillog.$n.bz2 ] 54 then 55 bzcat -fc /var/log/maillog.$n.bz2 56 fi 57 n=$(($n - 1)) 58 done 59 cat /var/log/maillog 60 } | |
54 sed -n -E "s/^$start"'.*ruleset=check_[^ ]+, +arg1=<?([^@]+@)?([^>,]+).*reject=([^ ]+) .* ([^ ]+)$/\2 (\3... \4)/p' | | 61 sed -n -E "s/^$start"'.*ruleset=check_[^ ]+, +arg1=<?([^@]+@)?([^>,]+).*reject=([^ ]+) .* ([^ ]+)$/'"$sed_output"'/p' | |
55 sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l) 56 [ $rc -gt 0 ] && rc=1 57 fi;; 58 59 *) rc=0;; 60esac 61 62exit $rc | 62 sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l) 63 [ $rc -gt 0 ] && rc=1 64 fi;; 65 66 *) rc=0;; 67esac 68 69exit $rc |