X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=modules%2Fstunnel4%2Ffiles%2Fetc-init.d-stunnel4;h=8921c4fef51e846521a8cd96dc56dc0f04235f18;hb=3f6e5777c3cd8a3e7751a0f96737f9bcad3a906a;hp=c4bb5ad6979f1f21c464cd3ff644d0d09dbecae8;hpb=e1ae7678b540e3aa94b2fcf5ab0d8c121d2c80c3;p=dsa-puppet.git diff --git a/modules/stunnel4/files/etc-init.d-stunnel4 b/modules/stunnel4/files/etc-init.d-stunnel4 index c4bb5ad6..8921c4fe 100755 --- a/modules/stunnel4/files/etc-init.d-stunnel4 +++ b/modules/stunnel4/files/etc-init.d-stunnel4 @@ -23,7 +23,9 @@ DESC="SSL tunnels" OPTIONS="" ENABLED=0 -if [ -n "${2-:}" ]; then +ulimit -n 4096 + +if [ -n "${2:-}" ]; then if [ -e "/etc/stunnel/$2.conf" ]; then FILES="/etc/stunnel/$2.conf" else @@ -74,10 +76,19 @@ killdaemons() { for file in $FILES; do PROCLIST=`get_pids $file` - if [ "$PROCLIST" ] && kill -0 $PROCLIST 2>/dev/null; then - kill $PROCLIST - echo -n "[stopped: $file] " - fi + for p in $PROCLIST; do + #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 } @@ -111,13 +122,13 @@ case "$1" in force-reload|restart) echo -n "Restarting $DESC: " killdaemons - sleep 5 + #sleep 5 startdaemons echo "$NAME." ;; *) N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|force-reload|restart}" >&2 + echo "Usage: $N {start|stop|force-reload|restart} []" >&2 exit 1 ;; esac