#! /bin/sh

. /etc/rc.status
rc_reset

LERCH_BIN="/home/alex/a_02_00/exed/servers/lerch"
LERCH_PID="/var/run/lerch.pid"

case "$1" in
    start)
	echo -n "Starting lerch "
	checkproc -p ${LERCH_PID} ${LERCH_BIN}
	case $? in
		0) echo -n "- Warning: lerch already running! " ;;
		1) echo -n "- Warning: ${LERCH_PID} exists! " ;;
	esac
	startproc -p ${LERCH_PID} ${LERCH_BIN} } 
	rc_status -v
	;;
    stop)
	echo -n "Shutting down lerch "
	checkproc -p ${LERCH_PID} ${LERCH_BIN} || echo -n "- Warning: named not running! "
	killproc -p ${LERCH_PID} -TERM ${LERCH_BIN}
	rc_status -v
	;;
    try-restart)
	$0 status >/dev/null && $0 restart
	rc_status
	;;
    restart)
	$0 stop
	$0 start
	rc_status
	;;
    force-reload)
	$0 reload
	rc_status
	;;
    status)
	echo -n "Checking for lerch "
	checkproc -p ${LERCH_PID} ${LERCH_BIN}
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|force-reload|reload}"
	exit 1
	;;
esac

rc_exit