#!/bin/sh
#
# chkconfig: - 80 80
# processname: esehttpd
# description: a http server
# config: /etc/esehttpd/esehttpd.conf
#

source /etc/rc.d/init.d/functions

case "$1" in
start)
	echo -n "Starting esehttpd: "
	if ( /usr/sbin/esehttpd ); then
		echo_success
	else
		echo_failure
	fi
	echo
	touch /var/lock/subsys/esehttpd
	;;
graceful)
	echo -n "Shutting down esehttpd (SIGHUP): "
	killproc esehttpd -HUP
	echo
	rm -f /var/lock/subsys/esehttpd
	;;
stop)
	echo -n "Shutting down esehttpd: "
	killproc esehttpd
	echo
	rm -f /var/lock/subsys/esehttpd
	;;
status)
	status esehttpd
	;;
configtest)
	if ( /usr/sbin/esehttpd -t ); then
		exit 0
	fi
	exit 1
	;;
restart)
	if ! $0 configtest ; then
		exit 1
	fi
	$0 graceful
	$0 start
	;;
*)
	echo "Usage: $0 {start|stop|restart|status|configtest}"
	exit 1
esac

exit 0

