From 49d3dace05818862acadfd6d4f94cee63523f841 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 10 Apr 2015 09:28:35 +0200 Subject: [PATCH] Try to make stunnel4 init script work on wheezy start-stop-daemon in wheezy does not have a --pid yet. Instead, it interprets it as --pidfile and things become sad. --- modules/stunnel4/files/etc-init.d-stunnel4 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/stunnel4/files/etc-init.d-stunnel4 b/modules/stunnel4/files/etc-init.d-stunnel4 index b916efcd4..8921c4fef 100755 --- a/modules/stunnel4/files/etc-init.d-stunnel4 +++ b/modules/stunnel4/files/etc-init.d-stunnel4 @@ -77,7 +77,16 @@ killdaemons() for file in $FILES; do PROCLIST=`get_pids $file` for p in $PROCLIST; do - start-stop-daemon --stop --retry 30 --pid "$p" + #start-stop-daemon --stop --retry 30 --pid "$p" + # start-stop-daemon in wheezy does not have a --pid yet, it interprets it as --pidfile + kill "$p" + c=150 + while [ "$c" -gt 0 ] && kill -0 "$p" 2> /dev/null ; do + sleep 0.20 + c=$((c - 1)) + [ "$((c % 5))" = 0 ] && echo -n . + done + if kill -0 "$p" 2> /dev/null; then kill -9 "$p"; fi echo -n "[stopped: $file] " done done @@ -113,7 +122,7 @@ case "$1" in force-reload|restart) echo -n "Restarting $DESC: " killdaemons - sleep 5 + #sleep 5 startdaemons echo "$NAME." ;; -- 2.20.1