I've been running fail2ban successfully for a long time on RHEL.
Now all of a sudden starting, stopping and restarting via /etc/init.d/fail2ban no longer works:
# /etc/init.d/fail2ban start
Starting fail2ban: [ OK ]
# service fail2ban status
Fail2ban (pid 31808) is running...
ERROR Unable to contact server. Is it running?
# /etc/init.d/fail2ban stop
Stopping fail2ban: [FAILED]
However if I do it this way it works:
# /usr/bin/fail2ban-client start
2014-02-11 15:46:13,863 fail2ban.server : INFO Starting Fail2ban v0.8.4
2014-02-11 15:46:13,863 fail2ban.server : INFO Starting in daemon mode
# /usr/bin/fail2ban-client status
Status
|- Number of jail: 10
`- Jail list: ...
#/usr/bin/fail2ban-client stop
Shutdown successful
The file /etc/init.d/fail2ban hasn't changed and I can't see anything wrong with it.
I figured it out.
There was a rogue fail2ban process running. After I killed it, fail2ban now restarts in the usual manner.
edited: commands mentioned is now the standardized "systemctl" instead of the old deprecated "service" as per @Michael Hampton currect suggestion :)
To kill any old processes of fail2ban you have a clean way and a dirty way as explained below.
Clean: this will also make sure no old rules/bans are left in the firewall
Dirty (1): Some rules might not be removed correctly
Dirty (2): Some rules might not be removed correctly