.\" $OpenBSD: watchdog.4,v 1.3 2005/09/12 10:05:14 jmc Exp $ .\" .\" Copyright (c) 2004 Michael Knudsen .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .Dd December 16, 2004 .Dt WATCHDOG 4 .Os .Sh NAME .Nm watchdog .Nd hardware timers/counters for quick crash recovery .Sh DESCRIPTION Hardware watchdog timers are devices that reboot the machine when it hangs. The kernel continually resets the watchdog clock on a regular basis. Thus, if the kernel halts, the clock will time out and reset the machine. Some watchdog timers may be configured to be reset from userland, causing a reboot if process scheduling fails. .Pp A few watchdog drivers are supported, and most support timeout configuration via .Xr sysctl 8 under the .Va kern.watchdog name: .Bl -tag -width kern.watchdog.period -offset indent .It Va kern.watchdog.auto Automatically reset .Pq Sq tickle the watchdog timer. .It Va kern.watchdog.period The timeout in seconds. Setting it to zero disables the watchdog timer. .El .Pp In situations where the machine provides vital services which are not handled completely in kernel space, e.g. mail exchange, it may be desirable to reboot the machine if process scheduling fails. This is done by setting .Va kern.watchdog.auto to zero and running a process which repeatedly sets .Va kern.watchdog.period to the desired timeout value. Then, if process scheduling fails, the process resetting the timer will not be run, leading to the machine being rebooted. .Pp Watchdog timers should be used in high-availability environments where getting machines up and running quickly after a crash is more important than determining the cause of the crash. A watchdog timer enables a crashed machine to autonomously attempt to recover quickly after a system failure. .Pp Note that this also means that it is unwise to combine watchdog timers with .Xr ddb 4 since the latter may prevent the former from resetting the watchdog timeout before it expires. This means that the machine will be rebooted before any debugging can be done. .Sh SEE ALSO .Xr ddb 4 , .Xr elansc 4 , .Xr geodesc 4 , .Xr ichwdt 4 , .Xr wdt 4 , .Xr config 8 , .Xr sysctl 8 , .Xr watchdogd 8 .Sh BUGS For systems with multiple watchdog timers available, only a single one can be used at a time. There is currently no way of selecting which device is used; the first discovered by the kernel is selected.