From frank@pinky.sax.de  Fri May  9 12:02:32 2008
Return-Path: <frank@pinky.sax.de>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2FDDC1065682
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  9 May 2008 12:02:32 +0000 (UTC)
	(envelope-from frank@pinky.sax.de)
Received: from post.frank-behrens.de (post.frank-behrens.de [82.139.255.138])
	by mx1.freebsd.org (Postfix) with ESMTP id 79E4C8FC20
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  9 May 2008 12:02:31 +0000 (UTC)
	(envelope-from frank@pinky.sax.de)
Received: from pinky.frank-behrens.de (post.frank-behrens.de [82.139.255.138])
	by post.frank-behrens.de (8.14.2/8.14.2) with ESMTP-IPv4 id m49BqHJM042748
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 9 May 2008 13:52:17 +0200 (CEST)
	(envelope-from frank@pinky.sax.de)
Received: from moon.behrens (localhost [127.0.0.1])
	by pinky.frank-behrens.de (8.14.2/8.14.2) with ESMTP-MSA id m49BqGpv042744
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 9 May 2008 13:52:16 +0200 (CEST)
	(envelope-from frank@moon.behrens)
Received: (from frank@localhost)
	by moon.behrens (8.14.2/8.14.2/Submit) id m49BqGlr042743;
	Fri, 9 May 2008 13:52:16 +0200 (CEST)
	(envelope-from frank)
Message-Id: <200805091152.m49BqGlr042743@moon.behrens>
Date: Fri, 9 May 2008 13:52:16 +0200 (CEST)
From: Frank Behrens <frank+bsdpr@harz.behrens.de>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [patch] /etc/periodic/daily/440.status-mailq should also print quarantined and lost queue entries
X-Send-Pr-Version: 3.113

>Number:         123551
>Category:       conf
>Synopsis:       [patch] [periodic] /etc/periodic/daily/440.status-mailq should also print quarantined and lost queue entries
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 09 12:10:00 UTC 2008
>Closed-Date:    
>Last-Modified:  Wed Jan 14 20:40:38 UTC 2009
>Originator:     Frank Behrens
>Release:        FreeBSD 7.0-BETA4-200712071613 i386
>Organization:
>Environment:
>Description:
The sendmail default mail queue can contain the following message types:
normal mails, quarantined mails and lost mails - see mailq(1).
The periodic status scripts prints only the 1st message type (normal messages).
To keep informed about quarantined and lost messages the other message entries should be
printed, too.

The attached patch implemements the output for quaratined and lost messages in a similar
manner as it was done for the client submission queue.

>How-To-Repeat:
Quarantine a message in sendmail, e.g. via a milter program. The default periodic script does
not inform about such message.
>Fix:
--- periodic_mailq_quarantine.patch begins here ---
--- etc/periodic/daily/440.status-mailq.orig	2007-12-08 18:09:45.000000000 +0100
+++ etc/periodic/daily/440.status-mailq	2008-05-09 13:25:38.000000000 +0200
@@ -58,6 +58,46 @@
 		    [ $rc_submit -gt 0 ] && rc=1
 		fi;;
 	    esac
+
+	    case "$daily_status_include_quarantine_mailq" in
+	    [Yy][Ee][Ss])
+		echo ""
+		echo "Mail in quarantine queue:"
+
+		rc_submit=$(case "$daily_status_mailq_shorten" in
+			[Yy][Ee][Ss])
+			    mailq -qQ |
+				egrep -e '^[[:space:]]+[^[:space:]]+@' |
+				sort |
+				uniq -c |
+				sort -nr |
+				awk '$1 >= 1 {print $1, $2}';;
+			*)
+			    mailq -qQ;;
+		esac | tee /dev/stderr |
+		egrep -v '(mqueue is empty|Total requests)' | wc -l)
+		[ $rc_submit -gt 0 ] && rc=1
+	    esac
+
+	    case "$daily_status_include_lost_mailq" in
+	    [Yy][Ee][Ss])
+		echo ""
+		echo "Mail in lost queue:"
+
+		rc_submit=$(case "$daily_status_mailq_shorten" in
+			[Yy][Ee][Ss])
+			    mailq -qL |
+				egrep -e '^[[:space:]]+[^[:space:]]+@' |
+				sort |
+				uniq -c |
+				sort -nr |
+				awk '$1 >= 1 {print $1, $2}';;
+			*)
+			    mailq -qL;;
+		esac | tee /dev/stderr |
+		egrep -v '(mqueue is empty|Total requests)' | wc -l)
+		[ $rc_submit -gt 0 ] && rc=1
+	    esac
 	fi;;
 		
     *)  rc=0;;
--- etc/defaults/periodic.conf.orig	2007-12-08 18:09:00.000000000 +0100
+++ etc/defaults/periodic.conf	2008-05-09 13:21:01.000000000 +0200
@@ -119,6 +119,8 @@
 daily_status_mailq_enable="YES"				# Check mail status
 daily_status_mailq_shorten="NO"				# Shorten output
 daily_status_include_submit_mailq="YES"			# Also submit queue
+daily_status_include_quarantine_mailq="YES"		# Also quarantine queue
+daily_status_include_lost_mailq="YES"			# Also lost queue
 
 # 450.status-security
 daily_status_security_enable="YES"			# Security check
--- periodic_mailq_quarantine.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:
 
