#!/bin/sh
#
# Red Hat Linux startup script for the Caudium Web Server
#
# Author:  Mike A. Harris <mharris@meteng.on.ca>
#          based on debian startup script written
#          by Marek Habersack <grendel@caudium.org>
#
# chkconfig: 345 85 15
# description: caudium web server
# processname: caudium

# Source function library.
. /etc/rc.d/init.d/functions

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON_DIR=/usr/lib/caudium
DAEMON=$DAEMON_DIR/start
NAME=caudium
DESC="Caudium Webserver"

PIDFILE=/var/run/caudium/caudium.pid
START_OPTIONS="--pid-file=$PIDFILE"


# See how we were called.
case "$1" in
  start)
	echo -n "Starting $NAME: "
	(
	 cd $DAEMON_DIR
	 daemon $DAEMON $START_OPTIONS 
	)
	echo
	touch /var/lock/subsys/caudium
	;;
  stop)
	echo -n "Shutting down caudium: "
	killproc caudium
	echo
	rm -f /var/lock/subsys/caudium
	;;
  status)
	status caudium
	;;
  restart)
	$0 stop
	sleep 3
	$0 start
	;;
#  reload)
#	echo -n "Reloading caudium: "
#	killproc caudium -HUP
#	echo
#	;;
  *)
	echo "Usage: $0 {start|stop|restart|status}"
	exit 1
esac

exit 0
