SVN: rc-scripts/trunk/lib/functions

glen glen at pld-linux.org
Wed Dec 5 21:54:16 CET 2012


Author: glen
Date: Wed Dec  5 21:54:15 2012
New Revision: 12603

Modified:
   rc-scripts/trunk/lib/functions
Log:
killproc: improve experimental start-stop-daemon based killing.

do not send --retry, in case we specify a signal to kill (usually HUP)
as processes do not usually exit (remove their pid from pidfile) if they receive HUP


Modified: rc-scripts/trunk/lib/functions
==============================================================================
--- rc-scripts/trunk/lib/functions	(original)
+++ rc-scripts/trunk/lib/functions	Wed Dec  5 21:54:15 2012
@@ -754,9 +754,17 @@
 	# experimental start-stop-daemon based killing.
 	# works only with pidfile
 	if is_no "$RC_LOGGING" && [ "$pidfile" ]; then
-		local sig=${killlevel:--TERM}
+		local sig=${killlevel:--TERM} retry
+		# retry only if signal is not specified,
+	   	# as otherwise impossible to send HUP if process pid stays in pidfile.
+		if [ "${killlevel+set}" = "set" ]; then
+			# if we send HUP it's ok if process does not die
+			retry="--oknodo"
+		else
+			retry="--retry ${sig#-}/10/${sig#-}/60/KILL/10"
+		fi
 		/sbin/start-stop-daemon -q --stop \
-			--retry ${sig#-}/10/${sig#-}/60/KILL/10 \
+			$retry \
 			-s ${sig#-} \
 			${pidfile:+--pidfile $pidfile}
 		result=$?


More information about the pld-cvs-commit mailing list