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
52 utility interfaces with the kernel's watchdog facility to ensure
53 that the system is in a working state.
56 is unable to interface with the kernel over a specific timeout,
57 the kernel will take actions to assist in debugging or restarting the computer.
63 will attempt to execute this command with
65 and only if the command returns with a zero exit code will the
69 is not specified, the daemon will perform a trivial file system
74 argument 'dry-run' will cause watchdog not to arm the system watchdog and
75 instead only run the watchdog function and report on failures.
76 This is useful for developing new watchdogd scripts as the system will not
77 reboot if there are problems with the script.
81 argument can be used to control the sleep period between each execution
82 of the check and defaults to 10 seconds.
86 specifies the desired timeout period in seconds.
87 The default timeout is 128 seconds.
89 One possible circumstance which will cause a watchdog timeout is an interrupt
93 will no longer execute and thus the kernel's watchdog routines will take
94 action after a configurable timeout.
97 .Fl T Ar script_timeout
98 specifies the threshold (in seconds) at which the watchdogd will complain
99 that its script has run for too long.
102 defaults to the value specified by the
112 will first instruct the kernel to no longer perform watchdog checks and then
117 utility recognizes the following runtime options:
120 Write the process ID of the
122 utility in the specified file.
125 When this option is specified,
127 will not fork into the background at startup.
129 Do not send a message to the system logger when the watchdog command takes
130 longer than expected to execute.
131 The default behaviour is to log a warning via the system logger with the
132 LOG_DAEMON facility, and to output a warning to standard error.
134 Complain when the watchdog script takes too long.
135 This flag will cause watchdogd to complain when the amount of time to
136 execute the watchdog script exceeds the threshold of 'sleep' option.
137 .It Fl -pretimeout Ar timeout
138 Set a "pretimeout" watchdog.
139 At "timeout" seconds before the watchdog will fire attempt an action.
140 The action is set by the --pretimeout-action flag.
141 The default is just to log a message (WD_SOFT_LOG) via
143 .It Fl -pretimeout-action Ar action
144 Set the timeout action for the pretimeout.
146 .Sx Timeout Actions .
148 Instead of arming the various hardware watchdogs, only use a basic software
150 The default action is just to
152 a message (WD_SOFT_LOG).
153 .It Fl -softtimeout-action Ar action
154 Set the timeout action for the softtimeout.
156 .Sx Timeout Actions .
159 The following timeout actions are available via the
160 .Fl -pretimeout-action
162 .Fl -softtimeout-action
164 .Bl -tag -width ".Ar printf "
168 when the timeout is reached.
170 Enter the kernel debugger via
172 when the timeout is reached.
176 when the timeout is reached.
180 to display a message to the console and
185 Actions can be combined in a comma separated list as so:
191 which will send messages both to
198 .Bl -tag -width ".Pa /var/run/watchdogd.pid" -compact
199 .It Pa /var/run/watchdogd.pid
202 .Ss Debugging watchdogd and/or your watchdog script.
203 This is a useful recipe for debugging
205 and your watchdog script.
207 (Note that ^C works oddly because
212 first ^C will terminate the "sleep" command.)
214 Explanation of options used:
215 .Bl -enum -offset indent -compact
217 Set Debug on (--debug)
219 Set the watchdog to trip at 30 seconds. (-t 30)
221 Use of a softtimeout:
222 .Bl -enum -offset indent -compact -nested
224 Use a softtimeout (do not arm the hardware watchdog).
227 Set the softtimeout action to do both kernel
232 (--softtimeout-action log,printf)
235 Use of a pre-timeout:
236 .Bl -enum -offset indent -compact -nested
238 Set a pre-timeout of 15 seconds (this will later trigger a panic/dump).
241 Set the action to also kernel
246 (--pretimeout-action log,printf)
250 .Bl -enum -offset indent -compact -nested
252 Run "sleep 60" as a shell command that acts as the watchdog (-e 'sleep 60')
254 Warn us when the script takes longer than 1 second to run (-w)
258 watchdogd --debug -t 30 \\
259 --softtimeout --softtimeout-action log,printf \\
260 --pretimeout 15 --pretimeout-action log,printf \\
263 .Ss Production use of example
264 .Bl -enum -offset indent -compact
266 Set hard timeout to 120 seconds (-t 120)
268 Set a panic to happen at 60 seconds (to trigger a
271 .Bl -enum -offset indent -compact -nested
273 Use of pre-timeout (--pretimeout 60)
275 Specify pre-timeout action (--pretimeout-action log,printf,panic )
279 .Bl -enum -offset indent -compact -nested
281 Run your script (-e '/path/to/your/script 60')
283 Log if your script takes a longer than 15 seconds to run time. (-w -T 15)
288 --pretimeout 60 --pretimeout-action log,printf,panic \\
289 -e '/path/to/your/script 60' -w -T 15
304 utility and manual page were written by
305 .An Sean Kelly Aq Mt smkelly@FreeBSD.org
307 .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
309 Some contributions made by
310 .An Jeff Roberson Aq Mt jeff@FreeBSD.org .
312 The pretimeout and softtimeout action system was added by
313 .An Alfred Perlstein Aq Mt alfred@freebsd.org .