#!/bin/sh
#
# wwwoffle	WWW proxy allowing offline view of cached pages
#
# chkconfig:	2345 85 20
#
# description:	WWW proxy allowing offline view of cached pages 


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

# Get network config
. /etc/sysconfig/network

# Get service config
[ -f /etc/sysconfig/wwwoffled ] && . /etc/sysconfig/wwwoffled

# Check that networking is up.
if is_no "${NETWORKING}"; then
        msg_network_down wwwoffle
	exit 1
fi

# See how we were called.
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/wwwoffle ]; then
		msg_starting wwwoffle
		daemon wwwoffled
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/wwwoffle
	else
		msg_already_running wwwoffled
		exit 1
	fi
        ;;
  stop)
        # Stop daemons.
        msg_stopping wwwoffle
	killproc wwwoffled
	rm  -f /var/lock/subsys/wwwoffle 2>&1 > /dev/null
	
        ;;
  restart)
        $0 stop
	$0 start
        ;;
  reload)
	if [ -f /var/lock/subsys/wwwoffle ]; then
		show Reload wwwoffled
		busy
		killproc wwwoffled -HUP
		deltext
		ok		
	else
		msg_not_running wwwoffled
		exit 1
	fi
	;;
  status)
	status wwwoffled
        ;;
  *)
        msg_usage "$0 {start|stop|status|restart|reload}"
        exit 1
esac

exit $RETVAL
