#! /bin/sh
#
# stone		Start/Stop Stone
#
# chkconfig: - 95  15
# description: The stone is TCP and UDP packet repeater.
# processname: stone
# pidfile: /var/run/stone.pid
# config: /etc/stone.conf

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

# Get config.
. /etc/sysconfig/network

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

[ -x /usr/bin/stone ] || exit 0

[ -f /etc/stone.conf ] || exit 0

OPTS="-C /etc/stone.conf"
RETVAL=0

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

exit $RETVAL
