#!/bin/bash
# pcontrol	This shell script takes care of starting and stopping
#		Parental Control
#
# chkconfig: 345 90 25
# description: pcontrol - Parental Control
# pidfile: /var/run/pcontrol.pid
# config: /etc/pcontrol/appctl.conf

### BEGIN INIT INFO
# Provides: pcontrol
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Short-Description: Starts the pcontrol service
# Description: Starts the pcontrol service
#              
### END INIT INFO


PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH

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

# Source networking configuration.
. /etc/sysconfig/network

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


FW=/usr/sbin/pcontrol-fw.sh


start() {
. /etc/pcontrol/filter.conf
if [ "${enable}" = "yes" ]
then
	$FW filter
else
	$FW proxy
fi

}

stop() {
	$FW stop
}    

restart() {
    stop
    start
}    

reload() {
    restart
}

case "$1" in
start)
    start
    ;;

stop)
    stop
    ;;

reload)
    reload
    ;;

restart)
    restart
    ;;

*)
    gprintf "Usage: %s {start|stop|status|reload|restart}\n" "$0"
    exit 1
esac

exit $?
