#!/bin/sh
# chkconfig: 35 21 99
# description: start the daemon for the linux watchdog as described\
#              in http://linuxfocus.org/English/July2002/article239.shtml
# processname: linuxwd
#
# This script will work with Redhat and Redhat compatible systems
# (such as Mandrake).
#
# start/stop the led and shutdown daemon
#
# save it as S21linuxwd
#
# you should start this as first process and terminate it as the
# last one (i.e you don't actually need a kill script).
# start/stop the led and shutdown daemon
#

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


[ -x /usr/sbin/linuxwd ] || exit 0
# change this accroding to the serial port where
# the WD is connected (ttyS0 or ttyS1):
DEVICE=/dev/ttyS1
RETVAL=0
# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting linuxwd: "
        daemon linuxwd $DEVICE
	RETVAL=$?
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down linuxwd: "
	killproc linuxwd
	RETVAL=$?
        ;;
  status)
	status linuxwd
	RETVAL=$?
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
        echo "Usage: linuxwd_rc {start|stop|restart|reload|status}"
        exit 1
esac

exit $RETVAL
