This patch allows to pass '--lockfile <file>' to status routine. This is needed when lockfile has custom name. By default name of lockfile is calculated as previously. --- /etc/rc.d/init.d/functions.orig 2004-06-27 18:56:13 +0400 +++ /etc/rc.d/init.d/functions 2004-08-28 02:36:12 +0400 @@ -382,11 +382,12 @@ return 1 fi - local WHICH BASENAME CMDNAME PIDFILE EXPECT FLAGS + local WHICH BASENAME CMDNAME PIDFILE LOCKFILE EXPECT FLAGS # Process options. CMDNAME= PIDFILE= + LOCKFILE= EXPECT= while [ "$1" != "${1##-}" ]; do case "$1" in @@ -404,6 +405,10 @@ PIDFILE="$1" shift ;; + --lockfile) + shift + LOCKFILE="$1" + shift --expect-user) shift EXPECT="$1" @@ -432,6 +437,10 @@ PIDFILE= fi + if [ -z "$LOCKFILE" ]; then + LOCKFILE="/var/lock/subsys/$BASENAME" + fi + if [ -n "$CMDNAME" -a -z "$PIDFILE" ]; then echo "status: --name is set but --pidfile is not set" >&2 return 1 @@ -457,7 +466,7 @@ return 1 fi - if [ -f "/var/lock/subsys/$BASENAME" ]; then + if [ -f "$LOCKFILE" ]; then echo "$BASENAME is dead, but subsystem is locked" return 2 fi Steps to Reproduce: 1. service snortd start 2. killall -9 snort 3. service snortd status Actual Results: snort is stopped Expected Results: snort is dead, but subsystem is locked
No, subsystem lockfile names must match startup script names, otherwise system shutdown procedure will not work properly, see /etc/rc.d/rc for details.
Well, start_daemon and stop_daemon have --lockfile option.
Implemented in service-0.5.6-alt1