#! /bin/sh
#
# Copyright (c) 1998-1999 Florian La Roche
#
# for SSL-support, you have to create a SSL server certificate with
# "rcapache certificate" and change this startup script to start the
# apache-server with "-DSSL"

PIDFILE=/var/run/httpd.pid

case "$1" in
    start)	echo "Starting WWW-Server apache."
		/local/www/sbin/httpd # -DSSL
		;;
    stop)	if test -f $PIDFILE ; then
			echo "Shutting down WWW-Server apache."
			killall -TERM -p`cat $PIDFILE` /local/www/sbin/httpd
		fi
		;;
    reload)	if test -f $PIDFILE ; then
			killall -USR1 -p`cat $PIDFILE` /local/www/sbin/httpd
		fi
		;;
    certificate)
		DIR=/local/www/conf/ssl.crt
		OUT=$DIR/server.pem
		ssleay req -new -x509 -nodes -out $OUT -keyout $OUT -days 30
		ln -sf server.pem $DIR/`ssleay x509 -noout -hash < $OUT`.0
		;;
    *)		echo "Usage: $0 {start|stop}"
		exit 1
esac

exit 0
