init.d script fixed

debian-releases/etch
Yaroslav Halchenko 2005-10-21 01:20:17 +00:00
parent f322d7205a
commit a1509ae1e4
2 changed files with 31 additions and 3 deletions

View File

@ -28,15 +28,41 @@ set -e
case "$1" in case "$1" in
start) start)
echo -n "Starting $DESC: " echo -n "Starting $DESC: "
if $0 status >/dev/null
then
$0 status
exit 1
fi
[ -f $PIDFILE ] && [ ! -d /proc/`cat $PIDFILE` ] && rm -f $PIDFILE [ -f $PIDFILE ] && [ ! -d /proc/`cat $PIDFILE` ] && rm -f $PIDFILE
start-stop-daemon --start --quiet --pidfile $PIDFILE \ start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec $DAEMON -- $DAEMON_OPTS --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME." echo ".done"
;; ;;
stop) stop)
echo -n "Stopping $DESC: " 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 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) restart|force-reload)
echo -n "Restarting $DESC: " echo -n "Restarting $DESC: "

4
debian/changelog vendored
View File

@ -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). * Fixed typos (thanx to Ross Boylan).
* Robust startup: if iptables module gets fully initialized after * 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 secondary solution for the bug 334272, fail2ban startup is moved
during bootup to the latest (S99) sequenece position. That should not during bootup to the latest (S99) sequenece position. That should not
cause any discomfort I believe. 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 <debian@onerussian.com> Tue, 18 Oct 2005 15:54:38 -0400 -- Yaroslav Halchenko <debian@onerussian.com> Tue, 18 Oct 2005 15:54:38 -0400