#! /bin/bash
#
# htpd         Start/Stop htpd
#
# description: htpd init script
#
# processname: htpd
# config: /etc/htpd.conf
# pidfile: /var/run/htpd.pid

# Source function library.
[ -f /etc/init.d/functions ] && . /etc/init.d/functions

RETVAL=0

# See how we were called.
prog="htpd"

prefix="@prefix@"
exec_prefix="@exec_prefix@"
bindir="@bindir@"
mandir="@mandir@"
sysconfdir="@sysconfdir@"
datadir="@datadir@"
localstatedir="@localstatedir@"

start() {
	echo -n $"Starting $prog: "
	daemon "${bindir}/htpd"
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/run/htpd.pid
	return $RETVAL
}

stop() {
	echo -n $"Stopping $prog: "
	"${bindir}/htpd" -k
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/run/htpd.pid
	return $RETVAL
}	

restart() {
	stop
	start
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		restart
		;;
	*)
		echo $"Usage: $0 {start|stop|restart}"
		exit 1
esac

exit $?
