Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Feb 2006 12:05:31 +0100 (CET)
From:      Petr Rehor <prehor@gmail.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        matteo@FreeBSD.org
Subject:   conf/93472: [patch] /etc/periodic/daily/440.status-mailq exits with bad value when daily_status_mailq_shorten is set to YES
Message-ID:  <200602171105.k1HB5VHc036249@charon.rx.cz>
Resent-Message-ID: <200602171110.k1HBAA8k011902@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         93472
>Category:       conf
>Synopsis:       [patch] /etc/periodic/daily/440.status-mailq exits with bad value when daily_status_mailq_shorten is set to YES
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 17 11:10:10 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Petr Rehor
>Release:        FreeBSD 6.0-RELEASE-c3 i386
>Organization:
>Environment:
System: FreeBSD charon.rx.cz 6.0-RELEASE-c3 FreeBSD 6.0-RELEASE-c3 #0: Tue Nov 8 20:44:39 UTC 2005 root@marvin.rx.cz:/usr/obj/usr/src/sys/GENERIC i386
>Description:
/etc/periodic/daily/440.status-mailq exits wits 0 when
daily_status_mailq_shorten is set to YES and you have two
mails with same recipient in mail queue.
>How-To-Repeat:
Put exactly two mails with same recipient to mail queue, set

	daily_status_mailq_shorten="YES"

in your /etc/periodic.conf and run

	/etc/periodic/daily/440.status-mailq; echo $?

It prints one about items in mail queue line to terminal but exits with 0.
>Fix:

--- 440.status-mailq.diff begins here ---
Index: 440.status-mailq
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/440.status-mailq,v
retrieving revision 1.10
diff -u -r1.10 440.status-mailq
--- 440.status-mailq	7 Feb 2006 08:21:06 -0000	1.10
+++ 440.status-mailq	17 Feb 2006 10:54:13 -0000
@@ -32,8 +32,9 @@
 			awk '$1 > 1 {print $1, $2}';;
 		*)
 		    mailq;;
-	    esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)
-	    [ $rc -gt 1 ] && rc=1 || rc=0
+	    esac | tee /dev/stderr |
+	    egrep -v '(mqueue is empty|Total requests)' | wc -l)
+	    [ $rc -gt 0 ] && rc=1 || rc=0
 
 	    case "$daily_status_include_submit_mailq" in
 	    [Yy][Ee][Ss])
@@ -52,8 +53,9 @@
 				awk '$1 > 1 {print $1, $2}';;
 			*)
 			    mailq -Ac;;
-		    esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)
-		    [ $rc_submit -gt 1 ] && rc=1
+		    esac | tee /dev/stderr |
+		    egrep -v '(mqueue is empty|Total requests)' | wc -l)
+		    [ $rc_submit -gt 0 ] && rc=1
 		fi;;
 	    esac
 	fi;;
--- 440.status-mailq.diff ends here ---


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602171105.k1HB5VHc036249>