SOURCES: wesnothd.init - use functions

glen glen at pld-linux.org
Thu Jan 4 09:49:42 CET 2007


Author: glen                         Date: Thu Jan  4 08:49:42 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

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

---- Diffs:

================================================================
Index: SOURCES/wesnothd.init
diff -u SOURCES/wesnothd.init:1.4 SOURCES/wesnothd.init:1.5
--- SOURCES/wesnothd.init:1.4	Thu Jan  4 09:25:58 2007
+++ SOURCES/wesnothd.init	Thu Jan  4 09:49:36 2007
@@ -11,9 +11,7 @@
 # Get service config
 [ -f /etc/sysconfig/wesnothd ] && . /etc/sysconfig/wesnothd
 
-RETVAL=0
-case "$1" in
-  start)
+start() {
 	if [ ! -f /var/lock/subsys/wesnothd ]; then
 		msg_starting wesnothd
 		daemon "su - wesnothd -s /bin/sh -c '/usr/bin/wesnothd -p 14999 > /dev/null 2>&1 &'"
@@ -22,8 +20,9 @@
 	else
 		msg_already_running wesnothd
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/wesnothd ]; then
 		msg_stopping wesnothd
 		killproc wesnothd
@@ -31,15 +30,23 @@
 	else
 		msg_not_running wesnothd
 	fi
+}
+
+RETVAL=0
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   status)
 	status wesnothd
 	exit $?
 	;;
   restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
+	stop
+	start
 	;;
   *)
 	msg_usage "$0 {start|stop|restart|force-reload|status}"
================================================================

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



More information about the pld-cvs-commit mailing list