#!/bin/sh
#
# chkconfig: 345 91 35
# description: Starts and stops the RPGD daemons

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

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check that smb.conf exists.
[ -f /etc/rpgd.conf ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting RPGD services: "
	daemon /usr/games/rpgd/bin/rpgd -d
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/rpgd || \
	   RETVAL=1
	;;
  stop)
	echo -n "Shutting down RPGD services: "
	killproc rpgd
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rpgd
	echo ""
	;;
  restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  status)
	status rpgd
	RETVAL=$?
	;;
  *)
	echo "Usage: $0 {start|stop|restart|status}"
	exit 1
esac

exit $RETVAL
