Bug 5086 - --lockfile switch is needed for 'status' routine in /etc/init.d/functions
: --lockfile switch is needed for 'status' routine in /etc/init.d/functions
Status: CLOSED FIXED
: Sisyphus
(All bugs in Sisyphus/service)
: unstable
: all Linux
: P2 minor
Assigned To:
:
:
:
:
:
  Show dependency tree
 
Reported: 2004-08-28 02:52 by
Modified: 2009-05-10 09:32 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2004-08-28 02:52:36
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
------- Comment #1 From 2004-09-01 19:30:51 -------
No, subsystem lockfile names must match startup script names, otherwise system
shutdown procedure will not work properly, see /etc/rc.d/rc for details.
------- Comment #2 From 2004-09-02 22:54:19 -------
Well, start_daemon and stop_daemon have --lockfile option.
------- Comment #3 From 2004-09-04 19:18:22 -------
Implemented in service-0.5.6-alt1