#!/bin/sh

. /etc/sysconfig/rc
. ${rc_functions}

PATH=/bin:/usr/bin:/sbin:/usr/sbin

test -x /usr/sbin/watchdog || exit 0

# For configuration of the init script use the file
# /etc/sysconfig/watchdog, do not edit this init script.

# Set run_watchdog to 1 to start watchdog or 0 to disable it.
run_watchdog=0

# Specify additional watchdog options here (see manpage).
watchdog_options=""

# Specify module to load
watchdog_module="none"

[ -e /etc/sysconfig/watchdog ] && . /etc/sysconfig/watchdog

DAEMON=/usr/sbin/watchdog
WD_DAEMON=/usr/sbin/wd_keepalive

case "${1}" in
	start)
		boot_mesg "Starting watchdog ..."
    		if [ $run_watchdog = 1 ]
    		then
    			# do we have to load a module?
			[ ${watchdog_module:-none} != "none" ] && /sbin/modprobe $watchdog_module

			loadproc $DAEMON $watchdog_options
    		fi
		;;

	stop)
		boot_mesg "Stopping watchdog ..."
		killproc $DAEMON
		;;

	restart)
		${0} stop
		sleep 1
		${0} start
		;;

	status)
		statusproc $DAEMON
		;;

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

