From 8ce3c2c19ead09465b49740c616e8bcbfb1cd89b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 3 Nov 2005 22:18:40 +0000 Subject: [PATCH] fixed init.d script so it doesn"t fail on stop action if fail2ban is not running --- config/debian-initd | 22 ++++++++++++---------- debian/changelog | 9 +++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/config/debian-initd b/config/debian-initd index b308379a..4f3c8543 100644 --- a/config/debian-initd +++ b/config/debian-initd @@ -30,7 +30,7 @@ case "$1" in echo -n "Starting $DESC: " if $0 status >/dev/null then - $0 status + ( $0 status ) exit 1 fi [ -f $PIDFILE ] && [ ! -d /proc/`cat $PIDFILE` ] && rm -f $PIDFILE @@ -40,15 +40,17 @@ case "$1" in ;; 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 + ( $0 status >/dev/null ) + case "$?" in + 0) fail2banpid=`cat $PIDFILE` ;; + 3) echo "done"; exit 0;; + *) + ( $0 status ) + echo "Not stopping fail2ban" + exit 1 + esac + + start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE maxsecs=30 i=0 while [ -f $PIDFILE ] && [ -d /proc/$fail2banpid ] \ diff --git a/debian/changelog b/debian/changelog index 76b9637c..33337c14 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +fail2ban (0.5.4-9) unstable; urgency=low + + * Fixed init.d script so it doesn't return non-0 status if fail2ban is not + running. That fixes issues with purging the package and leaving garbage in + /usr/share/fail2ban (Thanx to Justin Pryzby for the insight) + (closes: #337223) + + -- Yaroslav Halchenko Thu, 3 Nov 2005 17:05:20 -0500 + fail2ban (0.5.4-8) unstable; urgency=low * Added config option MAIL.localtime (closes: #336449)