SOURCES: xdm.init - use functions - force-reload is not supposed t...

qboosh qboosh at pld-linux.org
Sun Dec 2 14:02:41 CET 2007


Author: qboosh                       Date: Sun Dec  2 13:02:41 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions
- force-reload is not supposed to start service if not running
- added try-restart action (LSB 3.1)

---- Files affected:
SOURCES:
   xdm.init (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: SOURCES/xdm.init
diff -u SOURCES/xdm.init:1.11 SOURCES/xdm.init:1.12
--- SOURCES/xdm.init:1.11	Sat Oct 14 23:06:13 2006
+++ SOURCES/xdm.init	Sun Dec  2 14:02:36 2007
@@ -20,11 +20,7 @@
 	. /etc/sysconfig/xdm
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-	# Check if the service is already running?
+start() {
 	if [ ! -f /var/lock/subsys/xdm ]; then
 		msg_starting "X Display Manager"
 		daemon xdm
@@ -33,8 +29,9 @@
 	else
 		msg_already_running "X Display Manager"
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/xdm ]; then
 		msg_stopping "X Display Manager"
 		killproc xdm
@@ -42,18 +39,43 @@
 	else
 		msg_not_running "X Display Manager"
 	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/xdm ]; then
+		stop
+		start
+	else
+		msg_not_running xdm
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
 	;;
   status)
 	status xdm
 	exit $?
 	;;
-  restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
-	;;
   *)
-	msg_usage "$0 {start|stop|restart|force-reload|status}"
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
 	exit 3
 esac
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/xdm.init?r1=1.11&r2=1.12&f=u



More information about the pld-cvs-commit mailing list