#! /bin/sh
#
# ipac		IP Accounting Managment Tool
#
# description:  starts ipaccounting via ipfwadm
# chkconfig:    2345 35 67

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

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
	exit 0
fi

[ -r /etc/ipac.conf ] || exit 0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting IP Accounting system: "
	ipacset &
	touch /var/lock/subsys/ipac
	echo ipac
	;;
  stop)
	echo -n "Stopping IP Accounting system: "
	fetchipac
	ipfwadm -A -f
	rm -f /var/lock/subsys/ipac
	echo -n ipac
	echo
	;;
  restart)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit 0
