#!/bin/sh
#
# /etc/init.d/CDWserver
#
### BEGIN INIT INFO
# Provides:          CDWserver
# Required-Start:    $network
# Required-Stop:     $network
# Default-Start:     3 5
# Default-Stop:
# Description:       Network CD Writing
### END INIT INFO

# the path to your PID file
export pidFile=/var/run/CDWserver.pid

# the path to your CDWserver binary
CDWserver=/usr/sbin/CDWserver

# the path to your CDWserver config file
export CDWserverConfig=/etc/CDWserver/config

test -s /etc/rc.status && . /etc/rc.status

rc_reset

# See how we were called.
case "$1" in
	start)
		echo -n "Starting CDWserver"
		startproc $CDWserver
		rc_status -v
		;;
	stop)
		echo -n "Shutting down CDWserver"
		killproc -TERM $CDWserver
		rc_status -v
		;;
	restart)
		$0 stop
		$0 start
		rc_status
		;;
	condrestart)
		$0 restart
		;;
	status)
		lynx -dump http://localhost:12411
		;;
	*)
		echo "Usage: $0 {start|stop|restart|condrestart|status}"
		rc_failed 3
		rc_status -v
		;;
esac
rc_exit
