SOURCES: q3ded.init - run daemon (err, screen) as q3ded instead of...

glen glen at pld-linux.org
Sat Oct 15 21:38:00 CEST 2005


Author: glen                         Date: Sat Oct 15 19:38:00 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- run daemon (err, screen) as q3ded instead of root

---- Files affected:
SOURCES:
   q3ded.init (1.14 -> 1.15) 

---- Diffs:

================================================================
Index: SOURCES/q3ded.init
diff -u SOURCES/q3ded.init:1.14 SOURCES/q3ded.init:1.15
--- SOURCES/q3ded.init:1.14	Sat Oct 15 21:16:22 2005
+++ SOURCES/q3ded.init	Sat Oct 15 21:37:55 2005
@@ -44,8 +44,8 @@
 			fail
 			exit 1
 		fi
-		screen -A -m -d -S q3ded su -s /bin/sh quake3 -c "exec /usr/bin/q3ded ${Q3_OPTS}"
-		touch /var/lock/subsys/q3ded && ok
+		su -s /bin/sh - quake3 -c "screen -dmS q3ded /usr/bin/q3ded ${Q3_OPTS}"
+		touch /var/lock/subsys/q3ded && ok || fail
 	else
 		msg_already_running "Quake3 dedicated server"
 	fi
@@ -53,8 +53,7 @@
   stop)
 	if [ -f /var/lock/subsys/q3ded ]; then
 		msg_stopping "Quake3 dedicated server"
-		rm -f /var/lock/subsys/q3ded >/dev/null 2>&1
-		SCREEN_PID=`screen -ls | grep q3ded | awk -F . '{print $1}' | sed -e s/.//`
+		SCREEN_PID=$(su -s /bin/sh - quake3 -c "screen -ls" | awk -F. '/q3ded/{print $1}')
 		if [ ! -z "$SCREEN_PID" ]; then
 			Q3_PID=`pstree -p ${SCREEN_PID} |\
 				sed -e 's:^.*q3ded:: ; s:(:: ; s:)::'`
@@ -68,6 +67,7 @@
 		else
 			fail
 		fi
+		rm -f /var/lock/subsys/q3ded >/dev/null 2>&1
 	fi
 	exit 0
 	;;
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/q3ded.init?r1=1.14&r2=1.15&f=u




More information about the pld-cvs-commit mailing list