fail2ban: (strictly) ban hosts that are well over the ratelimit
[mirror/dsa-puppet.git] / modules / stunnel4 / files / etc-init.d-stunnel4
index 7bc871a..8921c4f 100755 (executable)
@@ -77,9 +77,18 @@ 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] "
-    fi
+    done
   done
 }
 
@@ -113,7 +122,7 @@ case "$1" in
   force-reload|restart)
         echo -n "Restarting $DESC: "
         killdaemons
-        sleep 5
+        #sleep 5
         startdaemons
         echo "$NAME."
         ;;