[syslog-ng] [PATCH] make 'syslog-ng -s' stay in the foreground

Balazs Scheidler bazsi at balabit.hu
Mon May 10 17:51:46 CEST 2010


On Sat, 2010-05-08 at 19:32 -0700, Corey Hickey wrote:
> Hi,
> 
> I recently upgraded to syslog-ng 3.1.1 and noticed messages like this
> appearing on terminals owned by root:
> 
> 2010 May  7 06:25:21 fire Daemon exited gracefully, not restarting;
> exitcode='0'
> 
> This is triggered by a daily logrotate cron job that runs 'syslog-ng -s'
> before sending the daemon a SIGHUP. It seems that 'syslog-ng -s' will
> daemonize and fork; the child process runs the syntax check and exits
> immediately, and then the parent process sends the above message via
> syslog(LOG_CRIT,...).
> 
> I can work around it by using 'syslog-ng -sF', but I also hacked up a
> small patch to force the process to be in the foreground when -s is
> specified. Is this useful? If not, I'll send a patch to Debian to use
> 'syslog-ng -sF' instead.

I've slightly changed your patch, but the goal is the same:

commit 5f82516db500209df040215c39da1b5adfc4d143
Author: Balazs Scheidler <bazsi at balabit.hu>
Date:   Mon May 10 17:50:22 2010 +0200

    main: stay in foreground if syntax-check or debug is requested
    
    There's simply no reason to go into the background just to check the
    syntax of the configuration file.
    
    Likewise, debug messages may generate feedback loops in the configuration
    thus it is not safe to enable them unless internal messages are only
    going to the stderr and syslog-ng is configured to be run in
    the foreground.
    
    Reported-By: Corey Hickey


It is on syslog-ng 3.0 master, but will eventually be forward ported to
the 3.1 branch as well.

-- 
Bazsi



More information about the syslog-ng mailing list