#!/bin/sh 

DAEMON=/usr/sbin/thttpd
test -f $DAEMON || exit 0

start() {
	echo -n "Starting thttpd: "
	$DAEMON -C /etc/thttpd.conf
	if [ $? != 0 ]; then
		echo "FAILED"
		exit 1
	else
		echo "done"
	fi
}

stop() {
	echo -n "Stopping ProFTPD: "
	kill -9 `cat /var/run/thttpd.pid`
        echo "done"
}

case "$1" in
    start)
	start
	;;

    stop)
	stop
	;;

    restart)
    	stop
    	start
	;;

    *)
	echo "Usage: /etc/init.d/S90thttpd {start|stop|restart}"
	exit 1
	;;
esac

exit 0