[projects/rc-scripts] killproc: retry when --waitfortime was specified
glen
glen at pld-linux.org
Mon May 18 11:45:29 CEST 2015
commit 57444cae3eb030a76261857d9d117f971cda0bd8
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Mon May 18 12:34:45 2015 +0300
killproc: retry when --waitfortime was specified
so services like ldap (using killproc --waitfortime 300 -TERM), would
wait for previous instance to be stopped
as TERM is default, ldap should not specify -TERM signal in fact.
also respect --waitname in ssd kill mode
lib/functions | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/lib/functions b/lib/functions
index f74eb3e..5bb3565 100644
--- a/lib/functions
+++ b/lib/functions
@@ -848,16 +848,25 @@ killproc() {
# works only with pidfile
if is_no "$RC_LOGGING" && [ "$pidfile" ]; then
local sig=${killlevel:--TERM} retry
- # retry only if signal is not specified,
+ # do not retry if signal is specified,
# as otherwise impossible to send HUP if process pid stays in pidfile.
- if [ "${killlevel+set}" = "set" ]; then
+ # however, do retry if --waitfortime was specified
+ if [ "${killlevel+set}" = "set" ] && [ -z "$waittime" ]; then
# if we send HUP it's ok if process does not die
retry="--oknodo"
else
- retry="--retry ${sig#-}/10/${sig#-}/60/KILL/10"
+ local waitretry
+ : ${waittime=10}
+ : ${waitretry=$(($waittime * 2))}
+
+ # 1. kill with $sig, wait $delay
+ # 2. kill with $sig, wait $waittime
+ # 3. kill with KILL, wait $waitretry
+ retry="--retry ${sig#-}/${delay}/${sig#-}/${waittime}/KILL/${waitretry}"
fi
/sbin/start-stop-daemon -q --stop \
$retry \
+ ${waitname:+--name $waitname} \
-s ${sig#-} \
${pidfile:+--pidfile $pidfile}
result=$?
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/57444cae3eb030a76261857d9d117f971cda0bd8
More information about the pld-cvs-commit
mailing list