#!/bin/sh
#
# monkey	monkey
#
# chkconfig:	2345 95 5
#
# description:	monkey WebServer daemon
#
# $Id: monkeyd.init,v 1.7 2005/12/08 01:02:49 glen Exp $

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

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

# Check that networking is up.
if is_yes "${NETWORKING}"; then
	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
		msg_network_down monkey
		exit 1
	fi
else
	exit 0
fi

RETVAL=0
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/monkey ]; then
		msg_starting monkey
		daemon monkey -D
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/monkey
	else
		msg_already_running monkey
	fi
	;;
  stop)
	if [ -f /var/lock/subsys/monkey ]; then
		# Stop daemons.
		msg_stopping monkey
		killproc monkey
		rm -f /var/lock/subsys/monkey
	else
		msg_not_running monkey
	fi
	;;
  status)
	status monkey
	exit $?
	;;
  restart|force-reload)
	$0 stop
	$0 start
	exit $?
	;;
  *)
	msg_usage "$0 {start|stop|restart|force-reload|status}"
	exit 3
esac

exit $RETVAL

# This must be last line !
# vi:syntax=sh:tw=78:ts=8:sw=4
