SOURCES: dovecot.init - check daemon running state before reload -...

qboosh qboosh at pld-linux.org
Fri Jan 11 22:17:14 CET 2008


Author: qboosh                       Date: Fri Jan 11 21:17:14 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- check daemon running state before reload
- reload is supported, so handle force-reload likewise
- added try-restart action (LSB 3.1)

---- Files affected:
SOURCES:
   dovecot.init (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/dovecot.init
diff -u SOURCES/dovecot.init:1.4 SOURCES/dovecot.init:1.5
--- SOURCES/dovecot.init:1.4	Wed Mar 28 12:14:32 2007
+++ SOURCES/dovecot.init	Fri Jan 11 22:17:09 2008
@@ -45,6 +45,27 @@
 	fi
 }
 
+reload() {
+	if [ -f /var/lock/subsys/dovecot ]; then
+		msg_reloading perlbal
+		killproc perlbal -HUP
+		RETVAL=$?
+	else
+		msg_not_running "Dovecot"
+		RETVAL=7
+	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/dovecot ]; then
+		stop
+		start
+	else
+		msg_not_running "Dovecot"
+		RETVAL=$1
+	fi
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
@@ -54,21 +75,22 @@
   stop)
   	stop
 	;;
-  restart|force-reload)
+  restart)
 	stop
 	start
 	;;
-  reload)
-  	msg_reloading "Dovecot"
-  	killproc dovecot -HUP
-	exit $?
+  try-restart)
+	condrestart 0
+	;;
+  reload|force-reload)
+  	reload
 	;;
   status)
   	status dovecot
 	exit $?
 	;;
   *)
-	msg_usage "$0 {start|stop|reload|restart|force-reload|status}"
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
 	exit 3
 esac
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/dovecot.init?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list