#!/bin/bash

# chkconfig: 35 90 12
# description: Murmur Service
# processname: murmur

[ -f /etc/rc.d/init.d/functions ] || exit 0
. /etc/rc.d/init.d/functions

RETVAL=0
PROG="/usr/local/murmur/murmur.x86"
ARGS="-ini /srv/murmur/murmur.ini"

start() {
	echo -n "Starting Murmur server: "
	daemon --user murmur $PROG $ARGS
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/murmur
	return $RETVAL
}

stop() {
	echo -n "Stopping Murmur server: "
	killproc $PROG
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/murmur
	return $RETVAL
}

case "$1" in
	start)
	start
	;;

	stop)
	stop
	;;

	status)
	status $PROG
	;;

	restart|reload|condrestart)
	stop
	sleep 2
	start
	;;

	*)
	echo "Usage: $0 {start|stop|status|restart|reload|condrestart}"
	exit 1
esac

exit $RETVAL
