slackbuilds_ponce/network/fail2ban/rc.fail2ban
Nishant Limbachia 493ef0f8c7 network/fail2ban: Minor cosmetic changes.
Signed-off-by: Erik Hanson <erik@slackbuilds.org>
2010-12-06 23:25:39 -06:00

69 lines
1.3 KiB
Bash

#!/bin/sh
#
# Copyright (c) 2008-2010, Nishant Limbachia, Hoffman Estates, IL, USA
# <nishant _AT_ mnspace _DOT_ net>
# /etc/rc.d/rc.fail2ban
#
# start|stop|restart|reload|status|ping fail2ban server
#
# To start fail2ban automatically at boot, make this file executable:
# chmod 755 /etc/rc.d/rc.fail2ban
# you must also add this file to rc.local for fail2ban to start during boot.
### default socket file is /var/run/fail2ban/fail2ban.sock which can be
### changed via the config file: /etc/fail2ban/fail2ban.conf
fail2ban_start() {
if [ -x /etc/rc.d/rc.fail2ban ]; then
echo "Starting fail2ban: "
### using -x option to remove any stale socket file.
/usr/bin/fail2ban-client -x start
fi
}
fail2ban_stop() {
echo "Stopping fail2ban"
/usr/bin/fail2ban-client stop
}
fail2ban_reload() {
echo "Reloading fail2ban"
/usr/bin/fail2ban-client reload
}
fail2ban_status() {
echo "Status: fail2ban"
/usr/bin/fail2ban-client status
}
fail2ban_ping() {
echo "Pinging fail2ban"
/usr/bin/fail2ban-client ping
}
case "$1" in
'start')
fail2ban_start
;;
'stop')
fail2ban_stop
;;
'restart')
fail2ban_stop
sleep 5
fail2ban_start
;;
'reload')
fail2ban_reload
;;
'status')
fail2ban_status
;;
'ping')
fail2ban_ping
;;
*)
echo "USAGE: $0 start|stop|restart|reload|status|ping"
exit 1
;;
esac