#!/bin/sh

# Bring up/down stats

. /etc/sysconfig/rc.conf
. /bin/network-functions

SETSID=/usr/bin/setsid
PIDFILE=/var/run/stats.pid
SERVICE=stats
PROCESS_NAME=stats

do_start ()
{
	if ! ServiceCheckRunning1 ; then
		return $?
	fi

	/etc/init.d/softdogd wait
	$SETSID /bin/$PROCESS_NAME
	ServiceCheckRunning2

	return $?
}

do_stop ()
{
	ServiceStop

	return $?
}

do_getvalues ()
{
	/etc/init.d/softdogd wait
	ServiceSendSIGHUP

	return $?
}

do_status ()
{
	ServiceStatus

	return $?
}

case "$1" in
	start)
		do_start
		;;
	stop)
		do_stop
		;;
	status)
		do_status
		;;
	getvalues)
		do_getvalues
		;;
	restart)
		do_stop
		do_start
		;;
	*)
		echo "Usage: $0 {start|stop|restart|status|getvalues}"
		exit 1
esac

exit $?
