Bug 23766

Summary: /etc/periodic/daily/440.status-mailq does not produce output when daily_status_mailq_shorten="YES" is specified
Product: Base System Reporter: lambert <lambert>
Component: miscAssignee: Brian Somers <brian>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff none

Description lambert 2000-12-22 17:30:01 UTC
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.

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.
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
Comment 1 Andy Farkas 2000-12-23 02:41:01 UTC
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/
Comment 2 Peter Pentchev 2000-12-23 10:35:38 UTC
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.
Comment 3 scott 2002-05-06 22:03:07 UTC
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
Comment 4 dwmalone freebsd_committer freebsd_triage 2002-05-07 08:59:36 UTC
Responsible Changed
From-To: freebsd-bugs->brian

Periodic script patch for Brian.
Comment 5 Brian Somers freebsd_committer freebsd_triage 2002-05-07 14:11:14 UTC
State Changed
From-To: open->closed

Committed to -current.  I'll MFC after 3 days if re@ ok it.