SOURCES: ApacheJServ.init - use start-stop-daemon, as rc-scripts d...

glen glen at pld-linux.org
Thu Dec 29 14:17:53 CET 2005


Author: glen                         Date: Thu Dec 29 13:17:53 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use start-stop-daemon, as rc-scripts does not provide --fork with --pidfile writing

---- Files affected:
SOURCES:
   ApacheJServ.init (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/ApacheJServ.init
diff -u SOURCES/ApacheJServ.init:1.4 SOURCES/ApacheJServ.init:1.5
--- SOURCES/ApacheJServ.init:1.4	Thu Oct  6 19:11:23 2005
+++ SOURCES/ApacheJServ.init	Thu Dec 29 14:17:47 2005
@@ -30,7 +30,7 @@
 	exit 0
 fi
 
-checkconfig() {
+getconfig() {
 	JRE=$(awk -F= '/^wrapper.bin=/{print $2}' $JSERV_PROPERTIES) || JRE=/usr/bin/java
 	CLASSPATH=$(awk -F= '/^wrapper\.classpath/{print $2}' $JSERV_PROPERTIES | tr '\n' ':')
 	ENV=$(awk -F= '/^wrapper.env=/{printf("%s=%s\n", $2, $3)}' $JSERV_PROPERTIES)
@@ -42,10 +42,22 @@
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/jserv ]; then
 		msg_starting jserv
-		checkconfig || exit 1
-		daemon --fork --user jserv env -i $ENV CLASSPATH="$CLASSPATH" $JRE $JSERV_CLASS $JSERV_PROPERTIES
+		getconfig || exit 1
+		start-stop-daemon --start \
+			--exec /usr/bin/env \
+			--pidfile /var/run/jserv.pid \
+			--make-pidfile \
+			--chuid jserv \
+			--background \
+			-- \
+			-i $ENV CLASSPATH="$CLASSPATH" $JRE $JSERV_CLASS $JSERV_PROPERTIES
 		RETVAL=$?
-		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/jserv
+		if [ $RETVAL -eq 0 ]; then
+			touch /var/lock/subsys/jserv
+			ok
+		else
+			fail
+		fi
 	else
 		msg_already_running jserv
 	fi
@@ -54,7 +66,7 @@
 	if [ -f /var/lock/subsys/jserv ]; then
 		# Stop daemons.
 		msg_stopping jserv
-		killproc jserv
+		killproc --pidfile jserv.pid jserv
 		rm -f /var/lock/subsys/jserv
 	else
 		msg_not_running jserv
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/ApacheJServ.init?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list