Home | History | Annotate | Line # | Download | only in rc.d
      1  1.1  thorpej #!/bin/sh
      2  1.1  thorpej #
      3  1.4    joerg # $NetBSD: wdogctl,v 1.4 2009/04/21 16:08:57 joerg Exp $
      4  1.1  thorpej #
      5  1.1  thorpej 
      6  1.3    joerg # PROVIDE: wdogctl
      7  1.4    joerg # BEFORE:  fsck_root
      8  1.1  thorpej 
      9  1.1  thorpej # The watchdog is configured VERY early, so that any problems that
     10  1.1  thorpej # occur during the bootstrap process are protected by the watchdog.
     11  1.1  thorpej 
     12  1.2  mycroft $_rc_subr_loaded . /etc/rc.subr
     13  1.1  thorpej 
     14  1.1  thorpej name="wdogctl"
     15  1.1  thorpej rcvar=$name
     16  1.1  thorpej 
     17  1.1  thorpej start_cmd="watchdog_start"
     18  1.1  thorpej stop_cmd="watchdog_stop"
     19  1.1  thorpej status_cmd="watchdog_status"
     20  1.1  thorpej 
     21  1.1  thorpej extra_commands="status"
     22  1.1  thorpej 
     23  1.1  thorpej watchdog_start()
     24  1.1  thorpej {
     25  1.1  thorpej 	if [ x"${wdogctl_flags}" = "x" ]; then
     26  1.1  thorpej 		warn "\${wdogctl_flags} is not set, watchdog not started"
     27  1.1  thorpej 	else
     28  1.1  thorpej 		echo "Starting watchdog timer."
     29  1.1  thorpej 		/sbin/wdogctl ${wdogctl_flags}
     30  1.1  thorpej 	fi
     31  1.1  thorpej }
     32  1.1  thorpej 
     33  1.1  thorpej watchdog_stop()
     34  1.1  thorpej {
     35  1.1  thorpej 	echo "Stopping watchdog timer."
     36  1.1  thorpej 	/sbin/wdogctl -d
     37  1.1  thorpej }
     38  1.1  thorpej 
     39  1.1  thorpej watchdog_status()
     40  1.1  thorpej {
     41  1.1  thorpej 	/sbin/wdogctl
     42  1.1  thorpej }
     43  1.1  thorpej 
     44  1.1  thorpej load_rc_config $name
     45  1.1  thorpej run_rc_command "$1"
     46