wok-backports view fail2ban/stuff/etc/init.d/fail2ban @ rev 34

Add: fail2ban. Update to 0.9.0'
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Mon Jun 02 01:04:27 2014 +0200 (2014-06-02)
parents
children
line source
1 #!/bin/sh
2 # /etc/init.d/fail2ban: Start, stop and restart Apache web server on SliTaz,
3 # at boot time or with the command line. Daemons options are configured
4 # with /etc/daemons.conf
5 #
6 . /etc/init.d/rc.functions
7 . /etc/daemons.conf
9 NAME=Fail2ban
10 DESC="Fail2ban Server"
11 DAEMON=/usr/bin/fail2ban-client
12 OPTIONS=
13 PIDFILE=/var/run/fail2ban/fail2ban.pid
14 SOCKET=/var/run/fail2ban/fail2ban.sock
16 case "$1" in
17 start)
18 if active_pidfile $PIDFILE fail2ban-server ; then
19 echo "$NAME already running."
20 exit 1
21 fi
22 echo -n "Starting $DESC: $NAME... "
23 rm -f $SOCKET
24 $DAEMON start > /dev/null
25 status
26 ;;
27 stop)
28 echo -n "Stopping $DESC: $NAME... "
29 $DAEMON stop
30 rm -f $PIDFILE
31 status
32 ;;
33 reload)
34 if ! active_pidfile $PIDFILE fail2ban-server ; then
35 echo "$NAME is not running."
36 exit 1
37 fi
38 echo -n "Stopping $DESC: $NAME... "
39 $DAEMON stop
40 status
41 ;;
42 restart)
43 if ! active_pidfile $PIDFILE fail2ban-server ; then
44 echo "$NAME is not running."
45 exit 1
46 fi
47 echo -n "Restarting $DESC: $NAME... "
48 $0 stop
49 $0 start
50 status
51 ;;
52 *)
53 echo ""
54 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|reload|restart]"
55 echo ""
56 exit 1
57 ;;
58 esac
60 exit 0