From owner-svn-src-head@FreeBSD.ORG Thu May 28 07:43:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8638106564A; Thu, 28 May 2009 07:43:06 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C47F8FC12; Thu, 28 May 2009 07:43:06 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S7h65p027453; Thu, 28 May 2009 07:43:06 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S7h6RI027452; Thu, 28 May 2009 07:43:06 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200905280743.n4S7h6RI027452@svn.freebsd.org> From: Brian Somers Date: Thu, 28 May 2009 07:43:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192970 - head/etc/periodic/daily X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2009 07:43:07 -0000 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;;