Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > b5d082724233db34dfc8dd6db99d9581 > files > 3

fwlogwatch-0.6-1mdk.i586.rpm

#!/bin/sh
# $Id: fwlogwatch.init.redhat,v 1.2 2001/08/19 09:54:45 bw Exp $
#
# Init file for fwlogwatch on redhat linux systems
#
# chkconfig: 2345 90 10
# description: Firewall log analysis with realtime response
#
# processname: fwlogwatch
# config: /etc/fwlogwatch.config
# pidfile: /var/run/fwlogwatch.pid

# source function library
. /etc/rc.d/init.d/functions

RETVAL=0
prog="fwlogwatch"

# Some functions to make the below more readable
FWLOGWATCH=/usr/local/sbin/fwlogwatch
PID_FILE=/var/run/fwlogwatch.pid


start()
{
	gprintf "Starting %s:" "$prog"
	initlog -c "$FWLOGWATCH -R -A -X -Pn" && success || failure
	RETVAL=$?
	[ "$RETVAL" = 0 ] && touch /var/lock/subsys/fwlogwatch
	echo
}

stop()
{
	gprintf "Stopping %s:" "$prog"
	killproc $FWLOGWATCH -TERM
	RETVAL=$?
	[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/fwlogwatch
	echo
}

reload()
{
	gprintf "Reloading %s:" "$prog"
	killproc $FWLOGWATCH -HUP
	RETVAL=$?
	echo
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		start
		;;
	reload)
		reload
		;;
	condrestart)
		if [ -f /var/lock/subsys/fwlogwatch ] ; then
			stop
			sleep 3
			start
		fi
		;;
	status)
		status $FWLOGWATCH
		RETVAL=$?
		;;
	*)
		gprintf "Usage: %s {start|stop|restart|reload|condrestart|status}\n" "$0"
		RETVAL=1
esac
exit $RETVAL