SOURCES: heimdal.init - use functions - force-reload is not suppos...

qboosh qboosh at pld-linux.org
Sat Jan 5 01:18:16 CET 2008


Author: qboosh                       Date: Sat Jan  5 00:18:16 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 (LSB 3.1)

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

---- Diffs:

================================================================
Index: SOURCES/heimdal.init
diff -u SOURCES/heimdal.init:1.12 SOURCES/heimdal.init:1.13
--- SOURCES/heimdal.init:1.12	Thu Dec  8 02:02:49 2005
+++ SOURCES/heimdal.init	Sat Jan  5 01:18:11 2008
@@ -29,11 +29,7 @@
 	exit 0
 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/heimdal ]; then
 		msg_starting "Kerberos KDC"
 		busy
@@ -49,8 +45,9 @@
 	else
 		msg_already_running "Kerberos KDC"
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/heimdal ]; then
 		msg_stopping "Kerberos KDC"
 		killproc kdc
@@ -58,18 +55,43 @@
 	else
 		msg_not_running "Kerberos KDC"
 	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/heimdal ]; then
+		stop
+		start
+	else
+		msg_not_running "Kerberos KDC"
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
 	;;
   restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
 	;;
   status)
 	status kdc
 	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/heimdal.init?r1=1.12&r2=1.13&f=u



More information about the pld-cvs-commit mailing list