From: <los...@us...> - 2007-02-20 20:44:52
|
Revision: 550 http://svn.sourceforge.net/fail2ban/?rev=550&view=rev Author: lostcontrol Date: 2007-02-20 12:44:47 -0800 (Tue, 20 Feb 2007) Log Message: ----------- - Added Suse init script and modified gentoo-initd. Thanks to Christian Rauch Modified Paths: -------------- trunk/CHANGELOG trunk/README trunk/files/gentoo-initd Added Paths: ----------- trunk/files/suse-initd Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-02-12 21:50:50 UTC (rev 549) +++ trunk/CHANGELOG 2007-02-20 20:44:47 UTC (rev 550) @@ -11,6 +11,8 @@ ---------- - Fixed asctime pattern in datedetector.py - Added new filters/actions. Thanks to Yaroslav Halchenko +- Added Suse init script and modified gentoo-initd. Thanks to + Christian Rauch ver. 0.7.7 (2007/02/08) - release candidate ---------- Modified: trunk/README =================================================================== --- trunk/README 2007-02-12 21:50:50 UTC (rev 549) +++ trunk/README 2007-02-20 20:44:47 UTC (rev 550) @@ -73,7 +73,7 @@ Jonathan Kamens, Stephen Gildea, Markus Hoffmann, Mark Edgington, Patrick Börjesson, kojiro, zugeschmiert, Tyler, Nick Munger, Christoph Haas, Justin Shore, Joël Bertrand, -René Berber, mEDI, Axel Thimm, Eric Gerbier +René Berber, mEDI, Axel Thimm, Eric Gerbier, Christian Rauch License: -------- Modified: trunk/files/gentoo-initd =================================================================== --- trunk/files/gentoo-initd 2007-02-12 21:50:50 UTC (rev 549) +++ trunk/files/gentoo-initd 2007-02-20 20:44:47 UTC (rev 550) @@ -42,29 +42,11 @@ } restart() { - if ! service_stopped "${SVCNAME}" ; then - svc_stop || return "$?" - einfon "Waiting for server to shutdown ." - cnt=0 - while [ 1 ]; do - # Ping fail2ban-server - ${FAIL2BAN} ping &> /dev/null - if [ ! "$?" == "0" ]; then - break - fi - cnt=`expr $cnt + 1` - if [ $cnt -gt 60 ] ; then - # We have waited 1 minute. Failed - echo - eend 1 "Failed" - break - fi - sleep 1 - echo -n "." - done - echo - fi - svc_start + if ! service_stopped "${SVCNAME}" ; then + svc_stop || return "$?" + sleep 1 + fi + svc_start } reload() { Added: trunk/files/suse-initd =================================================================== --- trunk/files/suse-initd (rev 0) +++ trunk/files/suse-initd 2007-02-20 20:44:47 UTC (rev 550) @@ -0,0 +1,87 @@ +#!/bin/sh +# +# /etc/init.d/fail2ban +# and its symbolic link +# /usr/sbin/rcfail2ban +# +### BEGIN INIT INFO +# Provides: fail2ban +# Required-Start: $syslog $remote_fs postfix +# Required-Stop: $syslog $remote_fs +# Should-Stop: $time ypbind sendmail +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Description: startup Fail2Ban +### END INIT INFO +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin +FAIL2BAN_BIN=/usr/local/bin/fail2ban-client +FAIL2BAN_SERVER=/usr/local/bin/fail2ban-server +FAIL2BAN_SOCKET=/tmp/fail2ban.sock +test -x $FAIL2BAN_BIN || { echo "$FAIL2BAN_BIN not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } + +# Check for existence of needed config file and read it +FAIL2BAN_CONFIG=/etc/fail2ban/fail2ban.conf +test -r $FAIL2BAN_CONFIG || { echo "$FAIL2BAN_CONFIG not existing"; + if [ "$1" = "stop" ]; then exit 0; + else exit 6; fi; } + +. /etc/rc.status + +# Reset status of this service +rc_reset + +case "$1" in + start) + echo -n "Starting Fail2Ban " + /sbin/startproc $FAIL2BAN_BIN -q start 2>1 > /dev/null + rc_status -v + ;; + stop) + echo -n "Shutting down Fail2ban " + /sbin/startproc $FAIL2BAN_BIN -q stop + rc_status -v + ;; + try-restart|condrestart) + if test "$1" = "condrestart"; then + echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" + fi + $0 status + if test $? = 0; then + $0 restart + else + rc_reset # Not running is not a failure. + fi + rc_status + ;; + restart) + $0 stop + i=60 + while [ -e $FAIL2BAN_SOCKET ] && [ $i -gt 60 ] + sleep 1 + i=$[i-1] + echo -n "." + done + echo "." + $0 start + + # Remember status and be quiet + rc_status + ;; + force-reload) + echo -n "Reload service Fail2ban " + /sbin/startproc $FAIL2BAN_BIN -q reload + rc_status -v + ;; + reload) + echo -n "Reload service Fail2ban " + /sbin/startproc $FAIL2BAN_BIN -q reload + rc_status -v + ;; + status) + echo -n "Checking for service Fail2ban " + /sbin/checkproc $FAIL2BAN_SERVER + rc_status -v + ;; + probe) Property changes on: trunk/files/suse-initd ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |