# 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=$?