From luca@morettoni.net  Thu Jan  9 03:04:21 2003
Return-Path: <luca@morettoni.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id EFE7F37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  9 Jan 2003 03:04:21 -0800 (PST)
Received: from myvision.it (morettoni.net [213.213.67.165])
	by mx1.FreeBSD.org (Postfix) with SMTP id 63B5943ED8
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  9 Jan 2003 03:04:20 -0800 (PST)
	(envelope-from luca@morettoni.net)
Received: (qmail 88594 invoked by uid 85); 9 Jan 2003 11:04:02 -0000
Received: from unknown (HELO ) (213.255.95.186)
  by 0 with SMTP; 9 Jan 2003 11:04:01 -0000
Received: (qmail 4703 invoked by uid 1001); 9 Jan 2003 11:02:20 -0000
Message-Id: <20030109110220.4702.qmail@morettoni.net>
Date: 9 Jan 2003 11:02:20 -0000
From: User & <luca@morettoni.net>
Reply-To: User & <luca@morettoni.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Add script run hook to newsyslog(8)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         46888
>Category:       bin
>Synopsis:       [patch] Add script run hook to newsyslog(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gad
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 09 03:10:02 PST 2003
>Closed-Date:    Fri Jul 29 11:27:19 UTC 2011
>Last-Modified:  Fri Jul 29 11:27:19 UTC 2011
>Originator:     Luca Morettoni
>Release:        FreeBSD 4.7-RELEASE-p2 i386
>Organization:
Luca Morettoni
>Environment:
System: FreeBSD luca.aerre.biz 4.7-RELEASE-p2 FreeBSD 4.7-RELEASE-p2 #0: Thu Dec 12 20:24:14 CET 2002 root@luca.aerre.biz:/usr/obj/usr/src/sys/LUCA i386


>Description:
This add to newsyslog the hook to run a user script after a log was archivied instead send
a signal to a daemon.
This is usefull for the program that don't handle signals for flushing logs (MySql for example).
To use this feature, set path_to_pif field in newsyslog.conf to the complete pathname of
the executable, prepended by a ! character (example: !/path_to_script).
The script is run only if:
- is user executable
- is owned by root (unless -r option is used)
- isn't group and world writable

I hope you enjoy this patch, and if there's some change to do, I'm here to help you (and FreeBSD too!)
Excuse for my very bad English!

>How-To-Repeat:

>Fix:
For src/usr/sbin/newsyslog: http://morettoni.net/bsd/newsyslog.c.diffs
                            http://morettoni.net/bsd/newsyslog.8.diffs

For src/etc: http://morettoni.net/bsd/newsyslog.conf.diffs

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gad 
Responsible-Changed-By: gad 
Responsible-Changed-When: Thu Feb 27 14:33:40 PST 2003 
Responsible-Changed-Why:  
I am currently doing a bunch of work on newsyslog, so I will also look 
at your update.  From your description it sounds very useful.  OpenBSD 
has a somewhat similar ability in their version of newsyslog, so what 
I will probably do is some combination of your update and theirs. 

Note that it may take me a few weeks before I get to this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=46888 
State-Changed-From-To: open->closed 
State-Changed-By: maxim 
State-Changed-When: Fri Jul 29 11:25:12 UTC 2011 
State-Changed-Why:  
The requested feature is implemented in HEAD and stable/8. 

From newsyslog.conf(5): 

R       if this flag is set the newsyslog(8) will run executable 
defined in path_to_pid_cmd_file after rotation instead of 
trying to send signal to a process id stored in the file. 

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