SOURCES: openct.init - added try-restart and force-reload - removed reload ...

qboosh qboosh at pld-linux.org
Mon Nov 17 17:59:38 CET 2008


Author: qboosh                       Date: Mon Nov 17 16:59:38 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- added try-restart and force-reload
- removed reload (only restart possible)

---- Files affected:
SOURCES:
   openct.init (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/openct.init
diff -u SOURCES/openct.init:1.1 SOURCES/openct.init:1.2
--- SOURCES/openct.init:1.1	Wed Dec 22 13:43:06 2004
+++ SOURCES/openct.init	Mon Nov 17 17:59:33 2008
@@ -9,11 +9,7 @@
 # Source function library
 . /etc/rc.d/init.d/functions
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-	# Check if the service is already running?
+start() {
 	if [ ! -f /var/lock/subsys/openct ]; then
 		show "Initializing OpenCT status"
 		busy
@@ -28,9 +24,9 @@
 	else
 		msg_already_running openct
 	fi
-	;;
-  stop)
-	# Stop daemons.
+}
+
+stop() {
 	if [ -f /var/lock/subsys/openct ]; then
 		show "Shutting down OpenCT"
 		busy
@@ -40,21 +36,43 @@
 	else
 		msg_not_running openct
 	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/openct ]; then
+		stop
+		start
+	else
+		msg_not_running openct
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
 	;;
-  status)
-	status openct
-	RETVAL=$?
+  stop)
+	stop
 	;;
   restart)
-	$0 stop
-	$0 start
-	exit $?
+	stop
+	start
 	;;
-  reload)
-  	$0 restart
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status openct
+	RETVAL=$?
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|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/openct.init?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list