r5726 - packages/trunk/pokerth/debian

Evgeni Golov sargentd-guest at alioth.debian.org
Tue Feb 12 17:25:15 UTC 2008


Author: sargentd-guest
Date: 2008-02-12 17:25:15 +0000 (Tue, 12 Feb 2008)
New Revision: 5726

Modified:
   packages/trunk/pokerth/debian/pokerth-server.init
   packages/trunk/pokerth/debian/pokerth-server.postinst
Log:
some more init.d stuff


Modified: packages/trunk/pokerth/debian/pokerth-server.init
===================================================================
--- packages/trunk/pokerth/debian/pokerth-server.init	2008-02-11 21:45:08 UTC (rev 5725)
+++ packages/trunk/pokerth/debian/pokerth-server.init	2008-02-12 17:25:15 UTC (rev 5726)
@@ -16,11 +16,12 @@
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/games
 DESC="PokerTH server"
-NAME=pokerth-server
-PIDFILE=/var/run/$NAME.pid
-DAEMON=/usr/games/pokerth_server
+NAME=pokerth_server
+PIDDIR=/var/run/pokerth
+PIDFILE=$PIDDIR/$NAME.pid
+DAEMON=/usr/games/$NAME
 DAEMON_ARGS="-p $PIDFILE"
-SCRIPTNAME=/etc/init.d/$NAME
+SCRIPTNAME=/etc/init.d/pokerth-server
 STARTAS_USER=pokerth
 STARTAS_GRP=pokerth
 
@@ -42,6 +43,13 @@
 #
 do_start()
 {
+
+	# create $PIDDIR if needed, so $STARTAS_USER can write to it
+	if [ ! -d $PIDDIR ]; then
+	  mkdir -p $PIDDIR
+	  chown $STARTAS_USER:$STARTAS_USER $PIDDIR
+	fi
+
 	# Return
 	#   0 if daemon has been started
 	#   1 if daemon was already running
@@ -63,7 +71,7 @@
 	#   1 if daemon was already stopped
 	#   2 if daemon could not be stopped
 	#   other if a failure occurred
-	start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --name $NAME
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
 	RETVAL="$?"
 	[ "$RETVAL" = 2 ] && return 2
 	# Wait for children to finish too if this is a daemon that forks
@@ -72,8 +80,8 @@
 	# that waits for the process to drop all resources that could be
 	# needed by services started subsequently.  A last resort is to
 	# sleep for some time.
-	#start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
-	#[ "$?" = 2 ] && return 2
+	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+	[ "$?" = 2 ] && return 2
 	# Many daemons don't delete their pidfiles when they exit.
 	rm -f $PIDFILE
 	return "$RETVAL"

Modified: packages/trunk/pokerth/debian/pokerth-server.postinst
===================================================================
--- packages/trunk/pokerth/debian/pokerth-server.postinst	2008-02-11 21:45:08 UTC (rev 5725)
+++ packages/trunk/pokerth/debian/pokerth-server.postinst	2008-02-12 17:25:15 UTC (rev 5726)
@@ -10,6 +10,7 @@
     if ! getent passwd pokerth >/dev/null; then
 	 adduser --system --group --home /var/lib/pokerth pokerth
     fi
+    chown pokerth:pokerth /var/run/pokerth
   fi
   ;;
   abort-upgrade|abort-remove|abort-deconfigure)




More information about the Pkg-games-commits mailing list