Package: syslog-ng
Version: 2.0.9-3
Severity: normal
Tags: patch

When I finished fixing bug #482981 I casually called 'restart' instead of 
'start' in the last machine patched.
Syslog-ng started immediatly, just complaining I invoked restart while it 
wasn't running.
The day after I found that pc's logs flooded of:

Error opening file for writing; filename='/dev/xconsole', error='No such file 
or directory'

That machine had a reboot with the broken script, so syslog-ng never even tried 
to start because of the broken "test -f /sbin/syslog-ng || exit 0".
Naturally, creating /dev/xconsole with "mknod -m 640 /dev/xconsole p" (like in 
create_xconsole function) solved the problem.
In the init script create_xconsole is invoked only on start, so using restart 
skipped the mknod.
I know it's unlikely to happen, but adding create_xconsole in all the pre 
"start-stop-daemon --start" phases easily fix this.

Attached the diff with my proposed changes.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (900, 'unstable'), (800, 'testing'), (100, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.25.3-phoenix
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages syslog-ng depends on:
ii  libc6                         2.7-12     GNU C Library: Shared libraries
ii  libevtlog0                    0.2.8~1-2  Syslog event logger library
ii  libglib2.0-0                  2.16.4-2   The GLib library of C routines
ii  lsb-base                      3.2-15     Linux Standard Base 3.2 init scrip

Versions of packages syslog-ng recommends:
di  logrotate                     3.7.1-3    Log rotation utility

syslog-ng suggests no packages.

-- no debconf information
--- syslog-ng   2008-07-27 15:25:15.000000000 +0200
+++ syslog-ng_alex      2008-07-27 15:32:16.000000000 +0200
@@ -20,11 +20,18 @@
 # Version:     @(#)skeleton  1.8  03-Mar-1998  [EMAIL PROTECTED]
 # This file was customized by SZALAY Attila <[EMAIL PROTECTED]>
 
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-test -f /sbin/syslog-ng || exit 0
 #we source /etc/default/syslog-ng if exists
 [ -r /etc/default/syslog-ng ] && . /etc/default/syslog-ng
 
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+SYSLOGNG="/usr/sbin/syslog-ng"
+NAME="syslog-ng"
+
+# stop syslog-ng before changing its PID file!
+PIDFILE="/var/run/syslog-ng.pid"
+
+test -f "$SYSLOGNG" || exit 0
+
 # Define LSB log_* functions.
 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
 . /lib/lsb/init-functions
@@ -45,11 +52,6 @@ then
   log_warning_msg "KERNEL_RINGBUF_SIZE option is useless and therefore 
removed."
 fi
 
-# stop syslog-ng before changing its PID file!
-PIDFILE="/var/run/syslog-ng.pid"
-
-SYSLOGNG="/sbin/syslog-ng"
-NAME="syslog-ng"
 
 create_xconsole() {
   if [ ! -e /dev/xconsole ]
@@ -59,6 +61,7 @@ create_xconsole() {
 }
                                 
 syslogng_start() {
+    create_xconsole
     log_daemon_msg "Starting system logging" "$NAME"
     start-stop-daemon --start --quiet --exec "$SYSLOGNG" \
                       --pidfile "$PIDFILE" -- -p "$PIDFILE" 
@@ -79,8 +82,9 @@ syslogng_stop() {
 
 syslogng_reload() {
     log_daemon_msg "Reload system logging" "$NAME"
-    if /sbin/syslog-ng -s
+    if "$SYSLOGNG" -s
     then
+      create_xconsole
       start-stop-daemon --stop --signal 1 --quiet --exec "$SYSLOGNG" \
                         --pidfile "$PIDFILE"
       RET="$?"
@@ -95,7 +99,6 @@ syslogng_reload() {
 
 case "$1" in
   start)
-    create_xconsole
     syslogng_start || exit 1
     ;;
   stop)
@@ -115,4 +118,3 @@ case "$1" in
 esac
 
 exit 0
-

Reply via email to