#!/bin/sh
# qw-serverd
#
# chkconfig:4 98 10
# description: QuakeWorld Master
# Functions library

. /etc/rc.d/init.d/functions

case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/qw-masterd ]; then
		msg_starting "QuakeWorld Master"
		busy
    		/usr/bin/qw-master > /dev/null &
		deltext
		ok
	else
		msg_Already_Running "QuakeWorld Master"
	        exit 1
	fi
	touch /var/lock/subsys/qw-masterd
	;;
  stop)

	if [ -f /var/lock/subsys/qw-masterd ]; then
		msg_stopping "QuakeWorld Master"
                killproc qw-master
                rm -f /var/lock/subsys/qw-masterd
        else
                msg_Not_Running "QuakeWorld Master"
                exit 1
	fi
	;;
  restart|reload)
        $0 stop
        $0 start
        ;;
  status)
	status /usr/bin/qw-master
	exit $?
	;;
  *)
	msg_Usage "$0 {start|stop|restart|reload|status}"
	exit 1
esac

exit 0
