diff --git a/config/debian-initd b/config/debian-initd index be788d4c..b308379a 100644 --- a/config/debian-initd +++ b/config/debian-initd @@ -28,15 +28,41 @@ set -e case "$1" in start) echo -n "Starting $DESC: " + if $0 status >/dev/null + then + $0 status + exit 1 + fi [ -f $PIDFILE ] && [ ! -d /proc/`cat $PIDFILE` ] && rm -f $PIDFILE start-stop-daemon --start --quiet --pidfile $PIDFILE \ --exec $DAEMON -- $DAEMON_OPTS - echo "$NAME." + echo ".done" ;; stop) echo -n "Stopping $DESC: " + if $0 status >/dev/null + then + fail2banpid=`cat $PIDFILE` + else + ( $0 status ) + echo "Not stopping fail2ban" + exit 1 + fi start-stop-daemon --stop --quiet --pidfile $PIDFILE - echo "$NAME." + maxsecs=30 + i=0 + while [ -f $PIDFILE ] && [ -d /proc/$fail2banpid ] \ + && [ $i -le $maxsecs ]; do + echo -n "." + sleep 1 + i=$(($i+1)) + done + if [ $i -eq $maxsecs ]; then + echo "ERROR: Fail2ban failed to stop properly. Tail of the log file is" + tail /var/log/fail2ban.log + exit 1 + fi + echo "done" ;; restart|force-reload) echo -n "Restarting $DESC: " diff --git a/debian/changelog b/debian/changelog index d7d2d19e..5e42eacf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -fail2ban (0.5.4-6.2) unstable; urgency=low +fail2ban (0.5.4-6.3) unstable; urgency=low * Fixed typos (thanx to Ross Boylan). * Robust startup: if iptables module gets fully initialized after @@ -9,6 +9,8 @@ fail2ban (0.5.4-6.2) unstable; urgency=low secondary solution for the bug 334272, fail2ban startup is moved during bootup to the latest (S99) sequenece position. That should not cause any discomfort I believe. + * Adjusted init.d script so it is resistant to delayed shutdowns of + fail2ban and in general more stable -- Yaroslav Halchenko Tue, 18 Oct 2005 15:54:38 -0400