Date: Thu, 28 May 2009 07:43:06 +0000 (UTC) From: Brian Somers <brian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r192970 - head/etc/periodic/daily Message-ID: <200905280743.n4S7h6RI027452@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brian Date: Thu May 28 07:43:06 2009 New Revision: 192970 URL: http://svn.freebsd.org/changeset/base/192970 Log: Update this script so that it handles different ruleset failures differently. The output now shows the ruleset and shortens to slightly different text (using $daily_status_mail_rejects_shorten), but it should be more descriptive. PR: 35018 Inspired by: Mikhail Teterin - mi at aldan dot algebra dot com MFC after: 3 weeks Modified: head/etc/periodic/daily/460.status-mail-rejects Modified: head/etc/periodic/daily/460.status-mail-rejects ============================================================================== --- head/etc/periodic/daily/460.status-mail-rejects Thu May 28 07:37:49 2009 (r192969) +++ head/etc/periodic/daily/460.status-mail-rejects Thu May 28 07:43:06 2009 (r192970) @@ -12,10 +12,8 @@ then fi case "$daily_status_mail_rejects_shorten" in -[Yy][Ee][Ss]) - sed_output='\4 \3...';; -*) - sed_output='\2 (\3... \4)';; +[Yy][Ee][Ss]) shorten='cut -d" " -f2,3';; +*) shorten=cat;; esac case "$daily_status_mail_rejects_enable" in @@ -39,7 +37,8 @@ case "$daily_status_mail_rejects_enable" echo echo Checking for rejected mail hosts: - start=`date -v-1d '+%b %e'` + yesterday=$(date -v-1d '+%b %e') + today=$(date '+%b %e') n=$(($daily_status_mail_rejects_logs - 2)) rc=$({ while [ $n -ge 0 ] @@ -57,9 +56,14 @@ case "$daily_status_mail_rejects_enable" n=$(($n - 1)) done cat /var/log/maillog - } | - sed -n -E "s/^$start"'.*ruleset=check_[^ ]+, +arg1=<?([^@]+@)?([^>,]+).*reject=([^ ]+) .* ([^ ]+)$/'"$sed_output"'/p' | - sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l) + } | sed -Ene "/^$today/q" -e "/^$yesterday/{"' + s/.*ruleset=check_relay,.* relay=([^,]+), reject=([^ ]*).*/\2 check_relay \1/p + t end + s/.*ruleset=check_rcpt,.* arg1=<?([^>,]+).* reject=([^ ]+) .* ([^ ]+)/\2 check_rcpt \1 \3/p + t end + s/.*ruleset=check_([^,]+),.* arg1=<?([^@]+@)?([^>,]+).* reject=([^ ]+) .* ([^ ]+)/\4 check_\1 \3 \5/p + :end + }' | eval $shorten | sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l) [ $rc -gt 0 ] && rc=1 fi;;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905280743.n4S7h6RI027452>