SOURCES: pound.init - add try-restart

glen glen at pld-linux.org
Fri Jan 9 14:54:14 CET 2009


Author: glen                         Date: Fri Jan  9 13:54:14 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- add try-restart

---- Files affected:
SOURCES:
   pound.init (1.19 -> 1.20) 

---- Diffs:

================================================================
Index: SOURCES/pound.init
diff -u SOURCES/pound.init:1.19 SOURCES/pound.init:1.20
--- SOURCES/pound.init:1.19	Fri Jan  9 14:50:19 2009
+++ SOURCES/pound.init	Fri Jan  9 14:54:08 2009
@@ -145,17 +145,22 @@
 	start
 }
 
-if [ "$1" != status -a "$2" ]; then
-	POUND_INSTANCES="$2"
-fi
+condrestart() {
+	if [ -f /var/lock/subsys/pound ]; then
+		stop
+		start
+	else
+		msg_not_running "Pound"
+		RETVAL=$1
+	fi
+}
 
 pound_status() {
-	local stat pidfile instance
+	local stat=1 pidfile instance
 
 	nls "Configured Pound instances:"
    	echo " $POUND_INSTANCES"
 	nls "Currently active Pound instances:"
-	stat=1
 	for pidfile in /var/run/pound/*.pid; do
 		[ -f "$pidfile" ] || continue
 		instance=${pidfile#/var/run/pound/}
@@ -167,6 +172,10 @@
 	exit $stat
 }
 
+if [ "$1" != status -a "$2" ]; then
+	POUND_INSTANCES="$2"
+fi
+
 RETVAL=0
 # See how we were called.
 case "$1" in
@@ -176,9 +185,15 @@
   stop)
   	stop
 	;;
-  restart|force-reload)
+  restart)
 	restart
 	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
   flush-logs)
 	if [ -f /var/lock/subsys/pound ]; then
 		for instance in $POUND_INSTANCES; do
@@ -198,7 +213,7 @@
 	pound_status
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|force-reload|flush-logs|status} [INSTANCE NAMES]"
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|flush-logs|status} [INSTANCE NAMES]"
 	exit 3
 esac
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/pound.init?r1=1.19&r2=1.20&f=u



More information about the pld-cvs-commit mailing list