1#!/bin/sh 2#
| 1#!/bin/sh 2#
|
3# $FreeBSD: head/etc/periodic/daily/460.status-mail-rejects 61981 2000-06-23 01:18:31Z brian $
| 3# $FreeBSD: head/etc/periodic/daily/460.status-mail-rejects 62274 2000-06-30 09:41:16Z brian $
|
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_enable" in 15 [Yy][Ee][Ss])
| 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_enable" in 15 [Yy][Ee][Ss])
|
16 if [ -d /etc/mail -a -f /var/log/maillog ]
| 16 if [ -d /etc/mail -a -f /var/log/maillog -a \ 17 "$daily_status_mail_rejects_logs" -gt 0 ]
|
17 then 18 echo 19 echo Checking for rejected mail hosts: 20 21 start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'`
| 18 then 19 echo 20 echo Checking for rejected mail hosts: 21 22 start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'`
|
22 zcat -fc /var/log/maillog.0* /var/log/maillog |
| 23 n=$(($daily_status_mail_rejects_logs - 2)) 24 { 25 while [ $n -ge 0 ] 26 do 27 [ -f /var/log/maillog.$n* ] && zcat -fc /var/log/maillog.$n* 28 n=$(($n - 1)) 29 done 30 cat /var/log/maillog 31 } |
|
23 perl -ne "print \"\$2\n\" 24 if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" | 25 sort | uniq -c | sort -nr 26 fi;; 27esac
| 32 perl -ne "print \"\$2\n\" 33 if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" | 34 sort | uniq -c | sort -nr 35 fi;; 36esac
|