Re: "combined" prerm script problem [Bug#337223: fail2ban: leaves garbage around after purge]
The bug is in the initscript.
LSB mandates that 'stop' not fail if the service is not running.
Replace this code:
"""
if $0 status >/dev/null
then
fail2banpid=`cat $PIDFILE`
else
( $0 status )
echo "Not stopping fail2ban"
exit 1
fi
"""
With code like this:
"""
$0 status >/dev/null
status=$?
if [ $status -eq 0 ];then # It is running
fail2banpid=`cat $PIDFILE`
elif [ $status -eq 3 ];then #It is not running we are done
echo "Done."
exit 0
else
( $0 status )
echo "Not stopping fail2ban"
exit 1
fi
"""
Then everything should run fine.
Reply to: