#!/bin/sh
#
# wwwoffle      This shell script takes care of starting and stopping
#               wwwoffle.
#
# chkconfig: - 85 15
# description: wwwoffle is offline www proxy server.
# processname: wwwoffled

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

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

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

[ -f /usr/sbin/wwwoffled ] || exit 0
[ -f /etc/wwwoffle.conf ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting wwwoffled: "
        daemon wwwoffled -c /etc/wwwoffle.conf
	RETVAL=$?
        echo
        touch /var/lock/subsys/wwwoffle
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down wwwoffled: "
	killproc wwwoffled
	RETVAL=$?
        echo
        rm -f /var/lock/subsys/wwwoffle
        ;;
  status)
	status wwwoffled
	;;
  restart|reload)
	/usr/bin/wwwoffle -config
	;;
  *)
        echo "Usage: wwwoffle {start|stop|restart|reload|status}"
        exit 1
esac

exit 0
