From chad@freebie.dcfinc.com Sun Mar 21 03:07:57 1999
Return-Path: <chad@freebie.dcfinc.com>
Received: from freebie.dcfinc.com (freebie.dcfinc.com [138.113.5.128])
	by hub.freebsd.org (Postfix) with ESMTP id F0C0A14BE2
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 21 Mar 1999 03:07:56 -0800 (PST)
	(envelope-from chad@freebie.dcfinc.com)
Received: (from chad@localhost) by freebie.dcfinc.com (8.8.7/8.8.3a) id EAA04417; Sun, 21 Mar 1999 04:07:37 -0700 (MST)
Message-Id: <199903211107.EAA04417@freebie.dcfinc.com>
Date: Sun, 21 Mar 1999 04:07:37 -0700 (MST)
From: chad@anasazi.com
Sender: chad@freebie.dcfinc.com
Reply-To: chad@dcfinc.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: enhancement to "newsyslog"
X-Send-Pr-Version: 3.2

>Number:         10705
>Category:       bin
>Synopsis:       enhancement to "newsyslog"
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 21 03:10:01 PST 1999
>Closed-Date:    Wed May 19 20:11:03 EDT 1999
>Last-Modified:  Wed May 19 20:11:33 EDT 1999
>Originator:     Chad R. Larson
>Release:        FreeBSD 2.2-STABLE i386
>Organization:
DCF, Inc. 
>Environment:

	Any 2.2-STABLE system

>Description:

	The current "newsyslog" program is useful for rolling log
	files other than those run by syslog.  But some of those
	uses do not involve a logging daemon, for example, keeping
	logs of cvsup operations, or the output of "make".  However,
	newsyslog as now delivered will try to signal some daemon at
	the conclusion of processing each line in its config file.

	You can avoid the signal by intentionally creating an
	invalid "path to pid" file, but that is a kludge and you
	have to put up with error messages.

>How-To-Repeat:

	

>Fix:
	
	I've added another option switch to the command line of
	newsyslog that supresses the attempt to send a signal.

	Here are patches...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** newsyslog.8.old	Sun Mar 21 03:50:41 1999
--- newsyslog.8	Sun Mar 21 03:51:18 1999
***************
*** 1,7 ****
  .\" This file contains changes from the Open Software Foundation.
  .\"
  .\"	from: @(#)newsyslog.8
! .\"	$Id: newsyslog.8,v 1.1 1999/03/19 21:35:16 toor Exp $
  .\"
  .\" Copyright 1988, 1989 by the Massachusetts Institute of Technology
  .\" 
--- 1,7 ----
  .\" This file contains changes from the Open Software Foundation.
  .\"
  .\"	from: @(#)newsyslog.8
! .\"	$Id: newsyslog.8,v 1.2 1999/03/19 23:52:10 toor Exp $
  .\"
  .\" Copyright 1988, 1989 by the Massachusetts Institute of Technology
  .\" 
***************
*** 25,31 ****
  .Nd maintain system log files to manageable sizes
  .Sh SYNOPSIS
  .Nm newsyslog
! .Op Fl Fnrv
  .Op Fl f Ar config_file
  .Sh DESCRIPTION
  .Nm Newsyslog
--- 25,31 ----
  .Nd maintain system log files to manageable sizes
  .Sh SYNOPSIS
  .Nm newsyslog
! .Op Fl Fnrsv
  .Op Fl f Ar config_file
  .Sh DESCRIPTION
  .Nm Newsyslog
***************
*** 149,154 ****
--- 149,158 ----
  .Nm
  not to trim the logs, but to print out what it would do if this option
  were not specified.
+ .It Fl s
+ Tell
+ .Nm
+ not to attempt to signal any daemon.
  .It Fl r
  Remove the restriction that
  .Nm
*** newsyslog.c.old	Sun Mar 21 03:57:51 1999
--- newsyslog.c	Sun Mar 21 03:51:18 1999
***************
*** 27,33 ****
  
  #ifndef lint
  static const char rcsid[] =
! 	"$Id: newsyslog.c,v 1.1 1999/03/19 21:35:16 toor Exp $";
  #endif /* not lint */
  
  #ifndef CONF
--- 27,33 ----
  
  #ifndef lint
  static const char rcsid[] =
! 	"$Id: newsyslog.c,v 1.3 1999/03/21 10:45:25 chad Exp $";
  #endif /* not lint */
  
  #ifndef CONF
***************
*** 90,95 ****
--- 90,96 ----
  int     verbose = 0;            /* Print out what's going on */
  int     needroot = 1;           /* Root privs are necessary */
  int     noaction = 0;           /* Don't do anything, just show it */
+ int	nokill = 0;		/* Don't signal the syslog daemon */
  int     force = 0;		/* Force the trim no matter what*/
  char    *conf = CONF;           /* Configuration file to use */
  time_t  timenow;
***************
*** 218,223 ****
--- 219,227 ----
                  case 'r':
                          needroot = 0;
                          break;
+                 case 's':
+                         nokill++;
+                         break;
                  case 'v':
                          verbose++;
                          break;
***************
*** 234,240 ****
  
  static void usage()
  {
!         fprintf(stderr, "usage: newsyslog [-Fnrv] [-f config-file]\n");
          exit(1);
  }
  
--- 238,244 ----
  
  static void usage()
  {
!         fprintf(stderr, "usage: newsyslog [-Fnrsv] [-f config-file]\n");
          exit(1);
  }
  
***************
*** 523,531 ****
  
  	pid = 0;
  	need_notification = notified = 0;
! 	if (pid_file != NULL) {
! 		need_notification = 1;
! 		pid = get_pid(pid_file);
  	}
  
  	if (pid) {
--- 527,537 ----
  
  	pid = 0;
  	need_notification = notified = 0;
! 	if (nokill == 0) {
! 		if (pid_file != NULL) {
! 			need_notification = 1;
! 			pid = get_pid(pid_file);
! 		}
  	}
  
  	if (pid) {

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Sun Mar 28 08:56:05 PST 1999 
State-Changed-Why:  
The newsyslog(8) manpage says path_to_pid_file is optional. What have 
you been smoking? :-) 
State-Changed-From-To: closed->open 
State-Changed-By: sheldonh 
State-Changed-When: Sun Mar 28 10:58:18 PST 1999 
State-Changed-Why:  
Closed in error. :-) 

From: Sheldon Hearn <sheldonh@iafrica.com>
To: chad@dcfinc.com
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/10705 
Date: Sun, 28 Mar 1999 21:03:04 +0200

 > > The newsyslog(8) manpage says path_to_pid_file is optional. What have
 > > you been smoking? :-)
 
 Newsyslog signals syslogd if path_to_pid_file is not specified.
 
 Gee, what have _I_ been smoking!?
 
 The PR's been re-opened. Either someone else'll do it, or it'll be
 amongst my first 5 commits. :-)
 
 Ciao,
 Sheldon.
 

From: "Chad R. Larson" <chad@freebie.dcfinc.com>
To: sheldonh@FreeBSD.org
Cc:  
Subject: Re: bin/10705
Date: Tue, 30 Mar 1999 18:23:54 -0700 (MST)

 > Synopsis: enhancement to "newsyslog"
 
 So very, very sorry.  An edit was somehow dropped out when I
 generated the diffs.  Here's fixed:
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 *** newsyslog.8	1999/03/19 21:35:16	1.1
 --- newsyslog.8	1999/03/31 01:03:19
 ***************
 *** 25,31 ****
   .Nd maintain system log files to manageable sizes
   .Sh SYNOPSIS
   .Nm newsyslog
 ! .Op Fl Fnrv
   .Op Fl f Ar config_file
   .Sh DESCRIPTION
   .Nm Newsyslog
 --- 25,31 ----
   .Nd maintain system log files to manageable sizes
   .Sh SYNOPSIS
   .Nm newsyslog
 ! .Op Fl Fnrsv
   .Op Fl f Ar config_file
   .Sh DESCRIPTION
   .Nm Newsyslog
 ***************
 *** 149,154 ****
 --- 149,158 ----
   .Nm
   not to trim the logs, but to print out what it would do if this option
   were not specified.
 + .It Fl s
 + Tell
 + .Nm
 + not to attempt to signal any daemon.
   .It Fl r
   Remove the restriction that
   .Nm
 *** newsyslog.c	1999/03/19 21:35:16	1.1
 --- newsyslog.c	1999/03/31 01:12:55
 ***************
 *** 90,95 ****
 --- 90,96 ----
   int     verbose = 0;            /* Print out what's going on */
   int     needroot = 1;           /* Root privs are necessary */
   int     noaction = 0;           /* Don't do anything, just show it */
 + int	nokill = 0;		/* Don't signal the syslog daemon */
   int     force = 0;		/* Force the trim no matter what*/
   char    *conf = CONF;           /* Configuration file to use */
   time_t  timenow;
 ***************
 *** 210,216 ****
   	}
   
           optind = 1;             /* Start options parsing */
 !         while ((c=getopt(argc,argv,"nrvFf:t:")) != -1)
                   switch (c) {
                   case 'n':
                           noaction++;
 --- 211,217 ----
   	}
   
           optind = 1;             /* Start options parsing */
 !         while ((c=getopt(argc,argv,"nrsvFf:t:")) != -1)
                   switch (c) {
                   case 'n':
                           noaction++;
 ***************
 *** 218,223 ****
 --- 219,227 ----
                   case 'r':
                           needroot = 0;
                           break;
 +                 case 's':
 +                         nokill++;
 +                         break;
                   case 'v':
                           verbose++;
                           break;
 ***************
 *** 234,240 ****
   
   static void usage()
   {
 !         fprintf(stderr, "usage: newsyslog [-Fnrv] [-f config-file]\n");
           exit(1);
   }
   
 --- 238,244 ----
   
   static void usage()
   {
 !         fprintf(stderr, "usage: newsyslog [-Fnrsv] [-f config-file]\n");
           exit(1);
   }
   
 ***************
 *** 523,531 ****
   
   	pid = 0;
   	need_notification = notified = 0;
 ! 	if (pid_file != NULL) {
 ! 		need_notification = 1;
 ! 		pid = get_pid(pid_file);
   	}
   
   	if (pid) {
 --- 527,537 ----
   
   	pid = 0;
   	need_notification = notified = 0;
 ! 	if (nokill == 0) {
 ! 		if (pid_file != NULL) {
 ! 			need_notification = 1;
 ! 			pid = get_pid(pid_file);
 ! 		}
   	}
   
   	if (pid) {
 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 	-crl
 --
 Chad R. Larson (CRL15)   602-953-1392   Brother, can you paradigm?
 chad@dcfinc.com chad@larsons.org chad@anasazi.com larson1@home.net   
 DCF, Inc. - 14623 North 49th Place, Scottsdale, Arizona 85254-2207
 
 
State-Changed-From-To: open->closed 
State-Changed-By: mph 
State-Changed-When: Wed May 19 20:11:03 EDT 1999 
State-Changed-Why:  
Requested by submitter. 
>Unformatted:
