SOURCES: cherokee.init - use functions, add try-restart

glen glen at pld-linux.org
Tue Oct 21 08:48:01 CEST 2008


Author: glen                         Date: Tue Oct 21 06:48:01 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions, add try-restart

---- Files affected:
SOURCES:
   cherokee.init (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: SOURCES/cherokee.init
diff -u SOURCES/cherokee.init:1.10 SOURCES/cherokee.init:1.11
--- SOURCES/cherokee.init:1.10	Tue Oct 21 02:26:23 2008
+++ SOURCES/cherokee.init	Tue Oct 21 08:47:55 2008
@@ -27,9 +27,7 @@
 	exit 0
 fi
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/cherokee ]; then
 		msg_starting "Cherokee Web Server"
@@ -49,8 +47,9 @@
 	else
 		msg_already_running "Cherokee Web Server"
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/cherokee ]; then
 		# Stop daemons.
 		msg_stopping "Cherokee Web Server"
@@ -65,22 +64,44 @@
 	else
 		msg_not_running "Cherokee Web Server"
 	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/cherokee ]; then
+		stop
+		start
+	else
+		msg_not_running "Cherokee Web Server"
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
 	;;
-  restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
+  stop)
+  	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
 	;;
   status)
 	status cherokee
 	RETVAL=$?
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|force-reload|status}"
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
 	exit 3
 esac
 
 exit $RETVAL
-
-# This must be last line !
-# vi:syntax=sh
================================================================

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



More information about the pld-cvs-commit mailing list