]> git.pld-linux.org Git - packages/fail2ban.git/commitdiff
New file
authoryaro <yaro@pld-linux.org>
Wed, 22 Oct 2008 21:46:42 +0000 (21:46 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    fail2ban.init -> 1.1

fail2ban.init [new file with mode: 0644]

diff --git a/fail2ban.init b/fail2ban.init
new file mode 100644 (file)
index 0000000..ffb2052
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# fail2ban     
+#
+# chkconfig: 345 92 08
+# description: Fail2ban daemon
+#              http://fail2ban.sourceforge.net/wiki/index.php/Main_Page
+# process name: fail2ban-server
+# pidfile:     /var/run/fail2ban.pid
+# config:      /etc/fail2ban/fail2ban.conf
+#
+
+#
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config
+[ -f /etc/sysconfig/fail2ban ] && . /etc/sysconfig/fail2ban
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down fail2ban
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+
+start() {
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/fail2ban ]; then
+               msg_starting fail2ban
+               daemon /usr/bin/fail2ban-client start
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fail2ban
+       else
+               msg_already_running fail2ban
+       fi
+}
+
+stop() {
+       # Stop daemons.
+       if [ -f /var/lock/subsys/fail2ban ]; then
+               msg_stopping fail2ban
+               daemon /usr/bin/fail2ban-client stop
+                rm -f /var/lock/subsys/fail2ban /var/run/fail2ban.pid >/dev/null 2>&1
+       else
+               msg_not_running fail2ban
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  status)
+       status fail2ban
+       RETVAL=$?
+       /usr/bin/fail2ban-client status
+       ;;
+  restart|reload)
+       stop
+       start
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|reload|status}"
+       exit 3
+       ;;
+esac
+
+exit $RETVAL
This page took 0.174807 seconds and 4 git commands to generate.