SOURCES: anubis.init - use functions - force-reload is not suppose...

qboosh qboosh at pld-linux.org
Sat Dec 1 01:25:46 CET 2007


Author: qboosh                       Date: Sat Dec  1 00:25:46 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions
- force-reload is not supposed to start service if not running
- added try-reload action (LSB 3.1)

---- Files affected:
SOURCES:
   anubis.init (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: SOURCES/anubis.init
diff -u SOURCES/anubis.init:1.7 SOURCES/anubis.init:1.8
--- SOURCES/anubis.init:1.7	Mon Jul  7 02:22:46 2003
+++ SOURCES/anubis.init	Sat Dec  1 01:25:41 2007
@@ -32,10 +32,7 @@
 # Get service config
 [ -f "/etc/sysconfig/$SERVICE" ] && . "/etc/sysconfig/$SERVICE"
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
   	if [ ! -f "$LOCKFILE" ]; then
 		msg_starting "$MSG"
 		daemon $PROG
@@ -44,8 +41,9 @@
 	else
 		msg_already_running $MSG
 	fi
-	;;
-  stop)
+}
+
+stop() {
   	if [ -f "$LOCKFILE" ]; then
 		msg_stopping "$MSG"
 		killproc $PROG
@@ -53,16 +51,41 @@
 	else
 		msg_not_running "$MSG"
 	fi
+}
+
+condrestart() {
+	if [ -f "$LOCKFILE" ]; then
+		stop
+		start
+	else
+		msg_not_running "$MSG"
+		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 $PROG
 	exit $?
 	;;
-  restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
-	;;
   *)
 	msg_usage "$0 {start|stop|restart|force-reload|status}"
 	exit 3
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/anubis.init?r1=1.7&r2=1.8&f=u



More information about the pld-cvs-commit mailing list