Changeset View
Changeset View
Standalone View
Standalone View
head/libexec/rc/rc.d/watchdogd
Show All 32 Lines | |||||
. /etc/rc.subr | . /etc/rc.subr | ||||
name="watchdogd" | name="watchdogd" | ||||
desc="Watchdog daemon" | desc="Watchdog daemon" | ||||
rcvar="watchdogd_enable" | rcvar="watchdogd_enable" | ||||
command="/usr/sbin/${name}" | command="/usr/sbin/${name}" | ||||
pidfile="/var/run/${name}.pid" | pidfile="/var/run/${name}.pid" | ||||
start_precmd="watchdogd_prestart" | |||||
stop_precmd="watchdogd_prestop" | |||||
stop_postcmd="watchdogd_poststop" | |||||
watchdog_command="/usr/sbin/watchdog" | |||||
load_rc_config $name | watchdogd_prestart() | ||||
{ | |||||
if [ -n "${watchdogd_timeout}" ] ; then | |||||
rc_flags="${rc_flags} -t ${watchdogd_timeout}" | |||||
fi | |||||
if [ -n "$watchdogd_shutdown_timeout" ] ; then | |||||
rc_flags="${rc_flags} -x ${watchdogd_shutdown_timeout}" | |||||
fi | |||||
return 0 | |||||
} | |||||
watchdogd_prestop() | |||||
{ | |||||
sig_stop="${watchdogd_sig_stop:-TERM}" | sig_stop="${watchdogd_sig_stop:-TERM}" | ||||
} | |||||
watchdogd_poststop() | |||||
{ | |||||
if [ ${watchdogd_shutdown_timeout:-0} -gt 0 ] ; then | |||||
case "${rc_shutdown}" in | |||||
"reboot") | |||||
info "watchdog timer is set to" \ | |||||
${watchdogd_shutdown_timeout} "before shutdown" | |||||
return 0 | |||||
;; | |||||
"single") | |||||
info "watchdog timer is disabled before going to" \ | |||||
"single user mode" | |||||
${watchdog_command} -t 0 | |||||
;; | |||||
"") | |||||
info "watchdog timer is disabled after administrative" \ | |||||
"${name} stop" | |||||
${watchdog_command} -t 0 | |||||
;; | |||||
*) | |||||
warn "unknown shutdown mode '${rc_shutdown}'" | |||||
warn "watchdog timer is set to ${watchdogd_shutdown_timeout}" | |||||
return 0 | |||||
;; | |||||
esac | |||||
fi | |||||
return 0 | |||||
} | |||||
load_rc_config $name | |||||
run_rc_command "$1" | run_rc_command "$1" |