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
39 .Op Fl -softtimeout-action Ar action
40 .Op Fl -pretimeout Ar timeout
41 .Op Fl -pretimeout-action Ar action
46 .Op Fl T Ar script_timeout
47 .Op Fl x Ar exit_timeout
51 utility interfaces with the kernel's watchdog facility to ensure
52 that the system is in a working state.
55 is unable to interface with the kernel over a specific timeout,
56 the kernel will take actions to assist in debugging or restarting the computer.
62 will attempt to execute this command with
64 and only if the command returns with a zero exit code will the
68 is not specified, the daemon will perform a trivial file system
73 argument 'dry-run' will cause watchdog not to arm the system watchdog and
74 instead only run the watchdog function and report on failures.
75 This is useful for developing new watchdogd scripts as the system will not
76 reboot if there are problems with the script.
80 argument can be used to control the sleep period between each execution
81 of the check and defaults to 10 seconds.
85 specifies the desired timeout period in seconds.
86 The default timeout is 128 seconds.
88 One possible circumstance which will cause a watchdog timeout is an interrupt
92 will no longer execute and thus the kernel's watchdog routines will take
93 action after a configurable timeout.
96 .Fl T Ar script_timeout
97 specifies the threshold (in seconds) at which the watchdogd will complain
98 that its script has run for too long.
101 defaults to the value specified by the
106 .Fl x Ar exit_timeout
107 argument is the timeout period (in seconds) to leave in effect when the
111 with a non-zero value protects against lockup during a reboot by
112 triggering a hardware reset if the software reboot doesn't complete
113 before the given timeout expires.
121 will terminate, after first instructing the kernel to either disable the
122 timeout or reset it to the value given by
123 .Fl x Ar exit_timeout .
127 utility recognizes the following runtime options:
130 Write the process ID of the
132 utility in the specified file.
135 When this option is specified,
137 will not fork into the background at startup.
139 Do not send a message to the system logger when the watchdog command takes
140 longer than expected to execute.
141 The default behaviour is to log a warning via the system logger with the
142 LOG_DAEMON facility, and to output a warning to standard error.
144 Complain when the watchdog script takes too long.
145 This flag will cause watchdogd to complain when the amount of time to
146 execute the watchdog script exceeds the threshold of 'sleep' option.
147 .It Fl -pretimeout Ar timeout
148 Set a "pretimeout" watchdog.
149 At "timeout" seconds before the watchdog will fire attempt an action.
150 The action is set by the --pretimeout-action flag.
151 The default is just to log a message (WD_SOFT_LOG) via
153 .It Fl -pretimeout-action Ar action
154 Set the timeout action for the pretimeout.
156 .Sx Timeout Actions .
158 Instead of arming the various hardware watchdogs, only use a basic software
160 The default action is just to
162 a message (WD_SOFT_LOG).
163 .It Fl -softtimeout-action Ar action
164 Set the timeout action for the softtimeout.
166 .Sx Timeout Actions .
169 The following timeout actions are available via the
170 .Fl -pretimeout-action
172 .Fl -softtimeout-action
174 .Bl -tag -width ".Ar printf "
178 when the timeout is reached.
180 Enter the kernel debugger via
182 when the timeout is reached.
186 when the timeout is reached.
190 to display a message to the console and
195 Actions can be combined in a comma separated list as so:
201 which will send messages both to
208 .Bl -tag -width ".Pa /var/run/watchdogd.pid" -compact
209 .It Pa /var/run/watchdogd.pid
212 .Ss Debugging watchdogd and/or your watchdog script.
213 This is a useful recipe for debugging
215 and your watchdog script.
217 (Note that ^C works oddly because
222 first ^C will terminate the "sleep" command.)
224 Explanation of options used:
225 .Bl -enum -offset indent -compact
227 Set Debug on (--debug)
229 Set the watchdog to trip at 30 seconds. (-t 30)
231 Use of a softtimeout:
232 .Bl -enum -offset indent -compact -nested
234 Use a softtimeout (do not arm the hardware watchdog).
237 Set the softtimeout action to do both kernel
242 (--softtimeout-action log,printf)
245 Use of a pre-timeout:
246 .Bl -enum -offset indent -compact -nested
248 Set a pre-timeout of 15 seconds (this will later trigger a panic/dump).
251 Set the action to also kernel
256 (--pretimeout-action log,printf)
260 .Bl -enum -offset indent -compact -nested
262 Run "sleep 60" as a shell command that acts as the watchdog (-e 'sleep 60')
264 Warn us when the script takes longer than 1 second to run (-w)
268 watchdogd --debug -t 30 \\
269 --softtimeout --softtimeout-action log,printf \\
270 --pretimeout 15 --pretimeout-action log,printf \\
273 .Ss Production use of example
274 .Bl -enum -offset indent -compact
276 Set hard timeout to 120 seconds (-t 120)
278 Set a panic to happen at 60 seconds (to trigger a
281 .Bl -enum -offset indent -compact -nested
283 Use of pre-timeout (--pretimeout 60)
285 Specify pre-timeout action (--pretimeout-action log,printf,panic )
289 .Bl -enum -offset indent -compact -nested
291 Run your script (-e '/path/to/your/script 60')
293 Log if your script takes a longer than 15 seconds to run time. (-w -T 15)
298 --pretimeout 60 --pretimeout-action log,printf,panic \\
299 -e '/path/to/your/script 60' -w -T 15
314 utility and manual page were written by
315 .An Sean Kelly Aq Mt smkelly@FreeBSD.org
317 .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
319 Some contributions made by
320 .An Jeff Roberson Aq Mt jeff@FreeBSD.org .
322 The pretimeout and softtimeout action system was added by
323 .An Alfred Perlstein Aq Mt alfred@freebsd.org .