#!/bin/sh
#
# template	Summary of the service.
#
# chkconfig: - 99 01
# description:	bmc-watchdog startup script
# processname: bmc-watchdog

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1
                 #

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

SourceIfNotEmpty /etc/sysconfig/bmc-watchdog

LOCKFILE=/var/lock/subsys/bmc-watchdog
RETVAL=0

start()
{
	start_daemon $NICE --lockfile "$LOCKFILE" --expect-user root -- bmc-watchdog $OPTIONS
	RETVAL=$?
	return $RETVAL
}

stop()
{
	stop_daemon --lockfile "$LOCKFILE" --expect-user root -- bmc-watchdog
	RETVAL=$?
	return $RETVAL
}

restart()
{
	stop
	start
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart|reload)
		restart
		;;
	condstop)
		if [ -e "$LOCKFILE" ]; then
			stop
		fi
		;;
	condrestart|condreload)
		if [ -e "$LOCKFILE" ]; then
			restart
		fi
		;;
	status)
		status --expect-user root -- bmc-watchdog
		RETVAL=$?
		;;
	*)
		msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
		RETVAL=1
esac

exit $RETVAL
