PKGBUILDs/community/fail2ban/fail2ban.rc
2009-10-09 21:15:33 -05:00

36 lines
585 B
Bash

#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
FAIL2BAN="/usr/bin/fail2ban-client"
case "$1" in
start)
stat_busy "Starting fail2ban"
$FAIL2BAN start >/dev/null
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon fail2ban
stat_done
fi
;;
stop)
stat_busy "Stopping fail2ban"
if [ "`$FAIL2BAN stop`" == "Shutdown successful" ]; then
rm_daemon fail2ban
stat_done
else
stat_fail
fi
;;
restart)
$0 stop
sleep 3
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0