SOURCES: xfs.init - use functions - added try-restart action (LSB ...

qboosh qboosh at pld-linux.org
Sun Dec 2 14:03:13 CET 2007


Author: qboosh                       Date: Sun Dec  2 13:03:13 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions
- added try-restart action (LSB 3.1)

---- Files affected:
SOURCES:
   xfs.init (1.12 -> 1.13) 

---- Diffs:

================================================================
Index: SOURCES/xfs.init
diff -u SOURCES/xfs.init:1.12 SOURCES/xfs.init:1.13
--- SOURCES/xfs.init:1.12	Sun Sep 17 18:17:31 2006
+++ SOURCES/xfs.init	Sun Dec  2 14:03:08 2007
@@ -19,11 +19,7 @@
 	. /etc/sysconfig/xfs
 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/xfs ]; then
 		msg_starting "X Font Server"
 		rm -fr /tmp/.font-unix
@@ -35,8 +31,9 @@
 	else
 		msg_already_running "X Font Server"
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/xfs ]; then
 		msg_stopping "X Font Server"
 		killproc xfs
@@ -44,28 +41,54 @@
 	else
 		msg_not_running "X Font Server"
 	fi
-	;;
-  status)
-	status xfs
-	exit $?
-	;;
-  restart)
-	$0 stop
-	$0 start
-	exit $?
-	;;
-  reload|force-reload)
+}
+
+reload() {
 	if [ -f /var/lock/subsys/xfs ]; then
 		msg_reloading "X Font Server"
 		killproc xfs -USR1
 		RETVAL=$?
 	else
 		msg_not_running "X Font Server"
-		exit 7
+		RETVAL=7
 	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/xfs ]; then
+		stop
+		start
+	else
+		msg_not_running xfs
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  reload|force-reload)
+	reload
+	;;
+  status)
+	status xfs
+	exit $?
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
 	exit 3
 esac
 
================================================================

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



More information about the pld-cvs-commit mailing list