1 .\" Copyright (c) 2013 iXsystems.com,
2 .\" author: Alfred Perlstein <alfred@freebsd.org>
3 .\" Copyright (c) 2004 Poul-Henning Kamp <phk@FreeBSD.org>
4 .\" Copyright (c) 2003 Sean M. Kelly <smkelly@FreeBSD.org>
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 .Op Fl -softtimeout-action Ar action
42 .Op Fl -pretimeout Ar timeout
43 .Op Fl -pretimeout-action Ar action
48 .Op Fl T Ar script_timeout
49 .Op Fl x Ar exit_timeout
53 utility interfaces with the kernel's watchdog facility to ensure
54 that the system is in a working state.
57 is unable to interface with the kernel over a specific timeout,
58 the kernel will take actions to assist in debugging or restarting the computer.
64 will attempt to execute this command with
66 and only if the command returns with a zero exit code will the
70 is not specified, the daemon will perform a trivial file system
75 argument 'dry-run' will cause watchdog not to arm the system watchdog and
76 instead only run the watchdog function and report on failures.
77 This is useful for developing new watchdogd scripts as the system will not
78 reboot if there are problems with the script.
82 argument can be used to control the sleep period between each execution
83 of the check and defaults to 10 seconds.
87 specifies the desired timeout period in seconds.
88 The default timeout is 128 seconds.
90 One possible circumstance which will cause a watchdog timeout is an interrupt
94 will no longer execute and thus the kernel's watchdog routines will take
95 action after a configurable timeout.
98 .Fl T Ar script_timeout
99 specifies the threshold (in seconds) at which the watchdogd will complain
100 that its script has run for too long.
103 defaults to the value specified by the
108 .Fl x Ar exit_timeout
109 argument is the timeout period (in seconds) to leave in effect when the
113 with a non-zero value protects against lockup during a reboot by
114 triggering a hardware reset if the software reboot doesn't complete
115 before the given timeout expires.
123 will terminate, after first instructing the kernel to either disable the
124 timeout or reset it to the value given by
125 .Fl x Ar exit_timeout .
129 utility recognizes the following runtime options:
132 Write the process ID of the
134 utility in the specified file.
137 When this option is specified,
139 will not fork into the background at startup.
142 Do not send a message to the system logger when the watchdog command takes
143 longer than expected to execute.
144 The default behaviour is to log a warning via the system logger with the
145 LOG_DAEMON facility, and to output a warning to standard error.
148 Complain when the watchdog script takes too long.
149 This flag will cause watchdogd to complain when the amount of time to
150 execute the watchdog script exceeds the threshold of 'sleep' option.
152 .It Fl -pretimeout Ar timeout
153 Set a "pretimeout" watchdog.
154 At "timeout" seconds before the watchdog will fire attempt an action.
155 The action is set by the --pretimeout-action flag.
156 The default is just to log a message (WD_SOFT_LOG) via
159 .It Fl -pretimeout-action Ar action
160 Set the timeout action for the pretimeout.
162 .Sx Timeout Actions .
165 Instead of arming the various hardware watchdogs, only use a basic software
167 The default action is just to
169 a message (WD_SOFT_LOG).
171 .It Fl -softtimeout-action Ar action
172 Set the timeout action for the softtimeout.
174 .Sx Timeout Actions .
178 The following timeout actions are available via the
179 .Fl -pretimeout-action
181 .Fl -softtimeout-action
183 .Bl -tag -width ".Ar printf "
187 when the timeout is reached.
190 Enter the kernel debugger via
192 when the timeout is reached.
197 when the timeout is reached.
202 to display a message to the console and
207 Actions can be combined in a comma separated list as so:
213 which will send messages both to
220 .Bl -tag -width ".Pa /var/run/watchdogd.pid" -compact
221 .It Pa /var/run/watchdogd.pid
224 .Ss Debugging watchdogd and/or your watchdog script.
225 This is a useful recipe for debugging
227 and your watchdog script.
229 (Note that ^C works oddly because
234 first ^C will terminate the "sleep" command.)
236 Explanation of options used:
237 .Bl -enum -offset indent -compact
239 Set Debug on (--debug)
241 Set the watchdog to trip at 30 seconds. (-t 30)
243 Use of a softtimeout:
244 .Bl -enum -offset indent -compact -nested
246 Use a softtimeout (do not arm the hardware watchdog).
249 Set the softtimeout action to do both kernel
254 (--softtimeout-action log,printf)
257 Use of a pre-timeout:
258 .Bl -enum -offset indent -compact -nested
260 Set a pre-timeout of 15 seconds (this will later trigger a panic/dump).
263 Set the action to also kernel
268 (--pretimeout-action log,printf)
272 .Bl -enum -offset indent -compact -nested
274 Run "sleep 60" as a shell command that acts as the watchdog (-e 'sleep 60')
276 Warn us when the script takes longer than 1 second to run (-w)
280 watchdogd --debug -t 30 \\
281 --softtimeout --softtimeout-action log,printf \\
282 --pretimeout 15 --pretimeout-action log,printf \\
285 .Ss Production use of example
286 .Bl -enum -offset indent -compact
288 Set hard timeout to 120 seconds (-t 120)
290 Set a panic to happen at 60 seconds (to trigger a
293 .Bl -enum -offset indent -compact -nested
295 Use of pre-timeout (--pretimeout 60)
297 Specify pre-timeout action (--pretimeout-action log,printf,panic )
301 .Bl -enum -offset indent -compact -nested
303 Run your script (-e '/path/to/your/script 60')
305 Log if your script takes a longer than 15 seconds to run time. (-w -T 15)
310 --pretimeout 60 --pretimeout-action log,printf,panic \\
311 -e '/path/to/your/script 60' -w -T 15
326 utility and manual page were written by
327 .An Sean Kelly Aq smkelly@FreeBSD.org
329 .An Poul-Henning Kamp Aq phk@FreeBSD.org .
331 Some contributions made by
332 .An Jeff Roberson Aq jeff@FreeBSD.org .
334 The pretimeout and softtimeout action system was added by
335 .An Alfred Perlstein Aq alfred@freebsd.org .