source: npl/monitoring/fail2ban/rc.fail2ban @ b4abfab

perl-5.22
Last change on this file since b4abfab was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#!/bin/sh
2#
3# Copyright (c) 2008-2010, Nishant Limbachia, Hoffman Estates, IL, USA
4# <nishant _AT_ mnspace _DOT_ net>
5# /etc/rc.d/rc.fail2ban
6#
7# start|stop|restart|reload|status|ping fail2ban server
8#
9# To start fail2ban automatically at boot, make this file executable:
10# chmod 755 /etc/rc.d/rc.fail2ban
11# you must also add this file to rc.local for fail2ban to start during boot.
12
13### default socket file is /var/run/fail2ban/fail2ban.sock which can be
14### changed via the config file: /etc/fail2ban/fail2ban.conf
15
16fail2ban_start() {
17  if [ -x /etc/rc.d/rc.fail2ban ]; then
18        echo "Starting fail2ban: "
19        ### using -x option to remove any stale socket file.
20        /usr/bin/fail2ban-client -x start
21  fi
22}
23
24fail2ban_stop() {
25        echo "Stopping fail2ban"
26        /usr/bin/fail2ban-client stop
27}
28
29fail2ban_reload() {
30        echo "Reloading fail2ban"
31        /usr/bin/fail2ban-client reload
32}
33
34fail2ban_status() {
35        echo "Status: fail2ban"
36        /usr/bin/fail2ban-client status
37}
38
39fail2ban_ping() {
40        echo "Pinging fail2ban"
41        /usr/bin/fail2ban-client ping
42}
43
44case "$1" in
45'start')
46        fail2ban_start
47  ;;
48'stop')
49        fail2ban_stop
50  ;;
51'restart')
52        fail2ban_stop
53        sleep 5
54        fail2ban_start
55;;
56'reload')
57        fail2ban_reload
58  ;;
59'status')
60        fail2ban_status
61  ;;
62'ping')
63        fail2ban_ping
64  ;;
65*)
66        echo "USAGE: $0 start|stop|restart|reload|status|ping"
67        exit 1
68  ;;
69esac
Note: See TracBrowser for help on using the repository browser.