blob: 75a1ace3822ea6a57379bca60b39f7e6772f51d2 (
plain)
1 #!/bin/sh
2 #
3 # /etc/rc.d/fail2ban: start/stop fail2ban daemon
4 #
5
6 # User settings here
7 DAEMON=fail2ban-client
8 export PATH="/sbin:/usr/sbin:/bin:/usr/bin:"
9
10 # Check for configuration files
11 [ -f /etc/fail2ban/fail2ban.conf ] || exit 1
12
13 # If you have to edit this section for this or any other
14 # port useage let me know, with a patch or added lines,
15 # or simplely e-mail me the altered file and I'll include the changes.
16
17 RETVAL=0
18
19 case $1 in
20 start)
21 echo -n "Starting $DAEMON..."
22 rm -rf /var/run/fail2ban/fail2ban.sock # in case of unclean shutdown
23 /usr/bin/$DAEMON start > /dev/null & RETVAL=$?
24 if [ $RETVAL = 0 ]; then
25 echo " done."
26 fi
27 ;;
28 stop)
29 echo -n "Shutting down $DAEMON..."
30 /usr/bin/$DAEMON stop > /dev/null
31 RETVAL=$?
32 echo " done."
33 ;;
34 restart)
35 $0 stop
36 sleep 2
37 $0 start
38 RETVAL=$?
39 ;;
40 *)
41 echo "usage: $0 [start|stop|restart]"
42 exit 1
43 ;;
44 esac
45
46 exit $RETVAL
47
48 # End of file
|