#!/bin/sh

echo "Starting World Wide Web Services...\c"

if [ ! -d /usr/bin ]
then			# /usr not mounted
	exit
fi


killproc() {		# kill the named process(es)
	pid=`/usr/bin/ps -e |
	     /usr/bin/grep $1 |
	     /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
	[ "$pid" != "" ] && kill $pid
}


# Start/stop processes required for WWW

case "$1" in
'start')
	echo "httpd..\c"
	if [ -x /usr/sbin/start_httpd ] ; then
		su www -c "/usr/sbin/start_httpd"
	fi
	echo "diswww..\c"
	if [ -x /usr/sbin/start_diswww ] ; then
		su www -c "/usr/sbin/start_diswww"
	fi
	;;

'stop')
	killproc httpd
	killproc diswww
	;;
*)
	echo "Usage: /etc/init.d/www.server { start | stop }"
	;;
esac

echo "done"
