SOURCES: watchdog.init - use functions - force-reload is not suppo...

qboosh qboosh at pld-linux.org
Mon Jan 14 17:51:45 CET 2008


Author: qboosh                       Date: Mon Jan 14 16:51:45 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions
- force-reload is not supposed to start service if not running
- added try-restart action

---- Files affected:
SOURCES:
   watchdog.init (1.13 -> 1.14) 

---- Diffs:

================================================================
Index: SOURCES/watchdog.init
diff -u SOURCES/watchdog.init:1.13 SOURCES/watchdog.init:1.14
--- SOURCES/watchdog.init:1.13	Mon Jan 14 15:34:59 2008
+++ SOURCES/watchdog.init	Mon Jan 14 17:51:40 2008
@@ -23,10 +23,7 @@
 	. /etc/sysconfig/watchdog
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
   	if [ ! -f /var/lock/subsys/watchdog ]; then
 		msg_starting watchdog
 		busy
@@ -49,8 +46,9 @@
 	else
 		msg_already_running watchdog
 	fi
-	;;
-  stop)
+}
+
+stop() {
   	if [ -f /var/lock/subsys/watchdog ]; then
 		msg_stopping watchdog
 		killproc watchdog
@@ -77,18 +75,43 @@
 	else
 		msg_not_running watchdog
 	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/watchdog ]; then
+		stop
+		start
+	else
+		msg_not_running watchdog
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
 	;;
-  status)
-	status watchdog
-	exit $?
+  stop)
+	stop
 	;;
   restart|force-reload)
-	$0 stop
-	$0 start
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status watchdog
 	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/watchdog.init?r1=1.13&r2=1.14&f=u



More information about the pld-cvs-commit mailing list