#!/bin/sh
#
###############################################################################
# lfd
# Copyright 2006-2012, Way to the Web Limited
# URL: http://www.configserver.com
# Email: sales@waytotheweb.com
###############################################################################
#
# chkconfig: 2345 80 30
# description: ConfigServer Firewall
#
### BEGIN INIT INFO
# Provides:          csf
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: ConfigServer Firewall
# Description:       Configures iptables firewall rules
### END INIT INFO
#

[ -f /usr/sbin/csf ] || exit 0

# Source function library.
if [ -f /etc/init.d/functions ]; then
	. /etc/init.d/functions
fi

DAEMON=/usr/sbin/csf

if [ -f /etc/SuSE-release ]; then
	. /etc/rc.status
	rc_reset
fi

# See how we were called.
case "$1" in
  start)
	echo -n "Starting csf:"
	$DAEMON -s
	if [ -f /etc/SuSE-release ]; then
		rc_status -v
	elif [ -f /etc/debian_version ] || [ -f /etc/lsb-release ] || [ -f /etc/gentoo-release ]; then
		echo " Done"
	else
		success
		echo
	fi
	echo
	;;
  stop)
	echo -n "Stopping csf:"
	$DAEMON -f
	if [ -f /etc/SuSE-release ]; then
		rc_status -v
	elif [ -f /etc/debian_version ] || [ -f /etc/lsb-release ] || [ -f /etc/gentoo-release ]; then
		echo " Done"
	else
		success
		echo
	fi
	echo
	;;
  status)
        echo -n "Status of csf:"
	$DAEMON -l
	echo
        ;;
  restart|force-reload)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: /etc/init.d/csf start|stop|restart|force-reload|status"
	exit 1
esac

exit 0
