From lambert@ssabsd.csw.net  Fri Dec 22 09:23:52 2000
Return-Path: <lambert@ssabsd.csw.net>
Received: from ssabsd.csw.net (ssabsd.csw.net [209.136.201.12])
	by hub.freebsd.org (Postfix) with ESMTP id C2B4E37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 22 Dec 2000 09:23:51 -0800 (PST)
Received: by ssabsd.csw.net (Postfix, from userid 1002)
	id C570313; Fri, 22 Dec 2000 11:23:23 -0600 (CST)
Message-Id: <20001222172323.C570313@ssabsd.csw.net>
Date: Fri, 22 Dec 2000 11:23:23 -0600 (CST)
From: lambert@ssabsd.csw.net
Reply-To: lambert@ssabsd.csw.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: /etc/periodic/daily/440.status-mailq does not produce output when daily_status_mailq_shorten="YES" is specified
X-Send-Pr-Version: 3.2

>Number:         23766
>Category:       misc
>Synopsis:       /etc/periodic/daily/440.status-mailq does not produce output when daily_status_mailq_shorten="YES" is specified
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    brian
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 22 09:30:01 PST 2000
>Closed-Date:    Tue May 07 06:11:42 PDT 2002
>Last-Modified:  Tue May 07 06:11:42 PDT 2002
>Originator:     Scott Lambert
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
CSW Net, Inc.
>Environment:

FreeBSD ssabsd.csw.net 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Tue Nov 21 13:43:32 CST 2000     lambert@ssabsd.csw.net:/usr/obj/usr/src/sys/SSABSD  i386

>Description:

I am not seeing any output from /etc/periodic/daily/440.status-mailq 
(v. 1.4.2.2) when I try to use the short form output by specifying
daily_status_mailq_shorten="YES" in /etc/periodic.conf.

Also, no output is produced if only one message to each uniq recipient is in
the mailq.  I think this give a false warm fuzzy to the admin.  So I think it
would be a good idea to have the number of messages before the awk script 
produces output configurable.  

>How-To-Repeat:

With multiple e-mails to the same recipient in your mailq run:

echo 'daily_status_mailq_shorten="YES"' >> /etc/periodic.conf
sh /etc/periodic/daily/440.status-mailq

>Fix:

This is probably not the right fix but it works here and I do not know enough
to produce anything better at this time.

*** 440.status-mailq.orig	Fri Dec 15 10:36:47 2000
--- 440.status-mailq	Fri Dec 15 10:41:50 2000
***************
*** 34,40 ****
  			sort |
  			uniq -c |
  			sort -nr |
! 			awk '$1 > 1 {print $1, $2}');;
  		*)
  		    mailq;;
  	    esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)
--- 34,41 ----
  			sort |
  			uniq -c |
  			sort -nr |
! 			awk "\$1 > $daily_mailq_shorten_min {print \$1, \$2}");
! 	    	    echo "$rc";;
  		*)
  		    mailq;;
  	    esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)


*** periodic.conf.dist	Fri Dec 15 12:47:52 2000
--- periodic.conf	Fri Dec 15 12:49:45 2000
***************
*** 106,111 ****
--- 106,114 ----
  # 440.status-mailq
  daily_status_mailq_enable="YES"				# Check mail status
  daily_status_mailq_shorten="NO"				# Shorten output
+ daily_mailq_shorten_min=1				# Number of uniq addrs
+ 							# in output must be >
+ 							# this number
  
  # 450.status-security
  daily_status_security_enable="YES"			# Security check

>Release-Note:
>Audit-Trail:

From: Andy Farkas <andyf@speednet.com.au>
To: lambert@ssabsd.csw.net
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG
Subject: Re: misc/23766: /etc/periodic/daily/440.status-mailq does not produce
 output when daily_status_mailq_shorten="YES" is specified
Date: Sat, 23 Dec 2000 13:41:01 +1100 (EST)

 On Fri, 22 Dec 2000 lambert@ssabsd.csw.net wrote:
 
 > *** periodic.conf.dist	Fri Dec 15 12:47:52 2000
 > --- periodic.conf	Fri Dec 15 12:49:45 2000
 > ***************
 > *** 106,111 ****
 > --- 106,114 ----
 >   # 440.status-mailq
 >   daily_status_mailq_enable="YES"				# Check mail status
 >   daily_status_mailq_shorten="NO"				# Shorten output
 > + daily_mailq_shorten_min=1				# Number of uniq addrs
 > + 							# in output must be >
 > + 							# this number
 >   
 >   # 450.status-security
 >   daily_status_security_enable="YES"			# Security check
 
 I like the idea of $daily_mailq_shorten_min being configurable, but the
 default should be 0, ie show all mailq entries, and maybe its name should
 be changed to something more conformist..?
 
 --
  
  :{ andyf@speednet.com.au
   
         Andy Farkas
     System Administrator
    Speednet Communications
  http://www.speednet.com.au/
   
 
 
 

From: Peter Pentchev <roam@orbitel.bg>
To: Andy Farkas <andyf@speednet.com.au>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: misc/23766: /etc/periodic/daily/440.status-mailq does not produce output when daily_status_mailq_shorten="YES" is specified
Date: Sat, 23 Dec 2000 12:35:38 +0200

 On Fri, Dec 22, 2000 at 06:50:02PM -0800, Andy Farkas wrote:
 >  On Fri, 22 Dec 2000 lambert@ssabsd.csw.net wrote:
 >  
 >  > *** periodic.conf.dist	Fri Dec 15 12:47:52 2000
 >  > --- periodic.conf	Fri Dec 15 12:49:45 2000
 >  > ***************
 >  > *** 106,111 ****
 >  > --- 106,114 ----
 >  >   # 440.status-mailq
 >  >   daily_status_mailq_enable="YES"				# Check mail status
 >  >   daily_status_mailq_shorten="NO"				# Shorten output
 >  > + daily_mailq_shorten_min=1				# Number of uniq addrs
 >  > + 							# in output must be >
 >  > + 							# this number
 >  >   
 >  >   # 450.status-security
 >  >   daily_status_security_enable="YES"			# Security check
 >  
 >  I like the idea of $daily_mailq_shorten_min being configurable, but the
 >  default should be 0, ie show all mailq entries, and maybe its name should
 >  be changed to something more conformist..?
 
 The 'show all mailq entries' is already controlled by the above setting -
 $daily_status_mailq_shorten.  The _min setting only takes effect when
 the other one is set to "YES", and then, 1 is the *current* default,
 so this patch is not changing anything in the current setup.
 
 G'luck,
 Peter
 
 -- 
 I am the meaning of this sentence.
 

From: Scott Lambert <scott@inch.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: misc/23766: /etc/periodic/daily/440.status-mailq does not produce output when daily_status_mailq_shorten="YES" is specified
Date: Mon, 6 May 2002 17:03:07 -0400

 Ok, so this still hasn't seen action.  I've left the job were it was 
 an issue for me and gotten a new job where it is again an issue.
 
 Here is an updated patch against the current -STABLE version of 
 /etc/periodic/daily/444.status-mailq.  I've left out the additional 
 control over how many entries have to be listed before a line is 
 printed as that may have been what kept the last patch from 
 being committed.
 
 --- etc/periodic/daily/440.status-mailq.orig    Mon May  6 16:45:05 2002
 +++ etc/periodic/daily/440.status-mailq Mon May  6 16:47:16 2002
 @@ -29,7 +29,8 @@
                         sort |
                         uniq -c |
                         sort -nr |
 -                       awk '$1 > 1 {print $1, $2}');;
 +                       awk '$1 > 1 {print $1, $2}');
 +                   echo "$rc";;
                 *)
                     mailq;;
             esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)
 @@ -49,7 +50,8 @@
                                 sort |
                                 uniq -c |
                                 sort -nr |
 -                               awk '$1 > 1 {print $1, $2}');;
 +                               awk '$1 > 1 {print $1, $2}');
 +                           echo "$rc";;
                         *)
                             mailq -Ac;;
                     esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)
 
 
 
 -- 
 Scott Lambert			KC5MLE
 System Administrator            scott@inch.com
Responsible-Changed-From-To: freebsd-bugs->brian 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Tue May 7 00:59:36 PDT 2002 
Responsible-Changed-Why:  
Periodic script patch for Brian. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=23766 
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Tue May 7 06:11:14 PDT 2002 
State-Changed-Why:  
Committed to -current.  I'll MFC after 3 days if re@ ok it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=23766 
>Unformatted:
