Skip to content

Commit dda55bc

Browse files
committed
Update documentation and bump version for v1.6 release.
Signed-off-by: Joachim Nilsson <[email protected]>
1 parent c58be52 commit dda55bc

File tree

3 files changed

+81
-42
lines changed

3 files changed

+81
-42
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
ROOTDIR ?= $(shell pwd)
2222

2323
# VERSION ?= $(shell git tag -l | tail -1)
24-
VERSION ?= 1.6-dev
24+
VERSION ?= 1.6
2525
NAME = watchdogd
2626
PKG = $(NAME)-$(VERSION)
27+
ARCHTOOL = `which git-archive-all`
2728
ARCHIVE = $(PKG).tar
2829
ARCHIVEZ = ../$(ARCHIVE).xz
2930
EXEC = $(NAME)

README.md

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,54 @@ Introduction
1616
------------
1717

1818
This is a slightly refactored and improved version of the original
19-
watchdogd from [uClinux-dist]. It was written by Michele d'Amico and
19+
watchdogd from [uClinux-dist][]. It was written by Michele d'Amico and
2020
later adapted to uClinux-dist by Mike Frysinger.
2121

2222

23+
**Example**
24+
25+
watchdogd -d /dev/watchdog2 -a 0.8,0.9 -w 120 -k 30
26+
27+
Most WDT drivers only support 120 sec as lowest timeout, but watchdogd
28+
tries to set 20 sec timeout. Example values above are recommendations
29+
30+
watchdogd runs at the default UNIX priority (nice) level.
31+
32+
2333
Usage
2434
-----
2535

26-
watchdogd [-fVL] [-w <sec>] [-k <sec>] [-s] [-x [NUM]]
27-
28-
--foreground, -f Start in foreground, background is default
29-
--external-kick, -x NUM Force external watchdog kick using SIGUSR1
30-
A 'NUM x INTERVAL' delay for startup is given
31-
--logfile, -l FILE Log to FILE when backgrounding, otherwise silent
32-
--syslog, -L Use syslog, even if in foreground
33-
--timeout, -w NUM Set the HW watchdog timeout to NUM seconds
34-
--interval, -k NUM Set watchdog kick interval to NUM seconds
35-
--safe-exit, -s Disable watchdog on exit from SIGINT/SIGTERM
36-
--verbose, -V Verbose operation, noisy output suitable for debugging
37-
--version, -v Display version and exit
38-
--help, -h Display this help message and exit
36+
watchdogd [-fxLsVvh] [-d /dev/watchdog] [-a WARN,REBOOT] [-w SEC] [-k SEC]
37+
38+
Options:
39+
-d, --device=<dev> Device to use, default: /dev/watchdog
40+
-f, --foreground Start in foreground (background is default)
41+
-x, --external-kick[=N] Force external watchdog kick using SIGUSR1
42+
A 'N x <interval>' delay for startup is given
43+
-l, --logfile=<file> Log to <file> in background, otherwise silent
44+
-L, --syslog Use syslog, even if in foreground
45+
-w, --timeout=<sec> Set the HW watchdog timeout to <sec> seconds
46+
-k, --interval=<sec> Set watchdog kick interval to <sec> seconds
47+
-s, --safe-exit Disable watchdog on exit from SIGINT/SIGTERM
48+
-a, --load-average=<val> Enable load average check <WARN,REBOOT>
49+
-V, --verbose Verbose, noisy output suitable for debugging
50+
-v, --version Display version and exit
51+
-h, --help Display this help message and exit
52+
53+
By default, watchdogd opens `/dev/watchdog`, attempts to set 20 sec WDT
54+
timeout and then kicks, in the background, every 10 sec.
3955

4056

4157
Features
4258
--------
4359

44-
The watchdogd can be used stand-alone to kick a kernel watchdog at
45-
`/dev/watchdog`, or with an external supervisor. The latter must use
46-
`SIGUSR1` to activate external kicks. To force an external supervisor
47-
daemon, use `--external-kick[=NUM]`, where NUM is an optional delay
48-
which can be quite useful at system startup. E.g., with `NUM=3`
49-
watchdogd will delay the handover three built-in kicks, providing the
50-
external supervisor enough time to start.
60+
watchdogd can be used stand-alone to kick a kernel `/dev/watchdog`, or
61+
with an external supervisor. The latter must use `SIGUSR1` to activate
62+
external kicks. Use `--external-kick[=NUM]` to force an external
63+
supervisor daemon, where NUM is an optional delay which can be quite
64+
useful at system startup. E.g., with `NUM=3` watchdogd will delay the
65+
handover three built-in kicks, providing the external supervisor enough
66+
time to start.
5167

5268
An external supervisor often need to lookup the PID to be able to send
5369
signals, watchdogd stores its PID in `/var/run/watchdogd.pid` like any
@@ -57,6 +73,15 @@ To force a kernel watchdog reboot, watchdogd supports `SIGPWR`. What
5773
it does is to set the WDT timer to the lowest possible value (1 sec),
5874
close the connection to `/dev/watchdog`, and wait for WDT reboot.
5975

76+
System load average monitoring can be enabeled with the `-a 0.8,0.9`
77+
command line argument. The two values, separated by a comma, is the
78+
normalized load level for logging a warning message and issuing a
79+
reboot, respectively. Normalized means watchdogd does not care how many
80+
CPU cores your system as online. If the Linux kernel `/proc/loadavg`
81+
file shows `3.9 3.0 2.5` on a four-core CPU, watchdogd will consider
82+
this as a load of `0.98 0.75 0.63`, i.e. divided by four. Only the one
83+
(1) and five (5) minute average values are used.
84+
6085

6186
Operation
6287
---------
@@ -87,17 +112,23 @@ everywhere. Enable `--verbose` and use `--syslog` a logfile or
87112
Origin & References
88113
-------------------
89114

90-
The [original code] in uClinux-dist has no license and is available in
115+
The [original code][] in uClinux-dist has no license and is available in
91116
the public domain, whereas this version is distributed under the ISC
92-
license. See the file [LICENSE] for more on this.
117+
license. See the file [LICENSE][] for more on this.
93118

94-
This project is maintained by [Joachim Nilsson] collaboratively at
95-
[GitHub]. Please file a bug reports, clone it, or send pull requests
119+
This project is maintained by [Joachim Nilsson][] collaboratively at
120+
[GitHub][]. Please file a bug reports, clone it, or send pull requests
96121
for bug fixes and proposed extensions, or become a co-maintainer by
97-
contacting the main author.
122+
contacting the maintainer.
98123

99124
[uClinux-dist]: http://www.uclinux.org/pub/uClinux/dist/
100125
[original code]: http://www.mail-archive.com/[email protected]/msg04191.html
101126
[GitHub]: http://github.com/troglobit/watchdogd
102127
[LICENSE]: https://github.com/troglobit/watchdogd/blob/master/LICENSE
103128
[Joachim Nilsson]: http://troglobit.com
129+
130+
<!--
131+
-- Local Variables:
132+
-- mode: markdown
133+
-- End:
134+
-->

watchdogd.c

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -232,23 +232,30 @@ static void period_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(event))
232232

233233
static int usage(int status)
234234
{
235-
printf("Usage: %s [-d <dev>] [-f] [-w <sec>] [-k <sec>] [-s] [-h|--help]\n"
236-
"A simple watchdog deamon that kicks /dev/watchdog every %d sec, by default.\n"
235+
printf("Usage:\n"
236+
" %s [-fxLsVvh] [-d /dev/watchdog] [-a WARN,REBOOT] [-w SEC] [-k SEC]\n\n"
237+
"Example:\n"
238+
" %s -d /dev/watchdog2 -a 0.8,0.9 -w 120 -k 30\n\n"
237239
"Options:\n"
238-
" --device, -d <dev> Device to use, default: " WDT_DEVNODE "\n"
239-
" --foreground, -f Start in foreground (background is default)\n"
240-
" --external-kick, -x [N] Force external watchdog kick using SIGUSR1\n"
240+
" -d, --device=<dev> Device to use, default: %s\n"
241+
" -f, --foreground Start in foreground (background is default)\n"
242+
" -x, --external-kick[=N] Force external watchdog kick using SIGUSR1\n"
241243
" A 'N x <interval>' delay for startup is given\n"
242-
" --logfile, -l <file> Log to <file> when backgrounding, otherwise silent\n"
243-
" --syslog, -L Use syslog, even if in foreground\n"
244-
" --timeout, -w <sec> Set the HW watchdog timeout to <sec> seconds\n"
245-
" --interval, -k <sec> Set watchdog kick interval to <sec> seconds\n"
246-
" --safe-exit, -s Disable watchdog on exit from SIGINT/SIGTERM\n"
247-
" --load-average, -a <val> Enable load average check <WARN,REBOOT>\n"
248-
" --verbose, -V Verbose operation, noisy output suitable for debugging\n"
249-
" --version, -v Display version and exit\n"
250-
" --help, -h Display this help message and exit\n",
251-
__progname, WDT_TIMEOUT_DEFAULT);
244+
" -l, --logfile=<file> Log to <file> in background, otherwise silent\n"
245+
" -L, --syslog Use syslog, even if in foreground\n"
246+
" -w, --timeout=<sec> Set the HW watchdog timeout to <sec> seconds\n"
247+
" -k, --interval=<sec> Set watchdog kick interval to <sec> seconds\n"
248+
" -s, --safe-exit Disable watchdog on exit from SIGINT/SIGTERM\n"
249+
" -a, --load-average=<val> Enable load average check <WARN,REBOOT>\n"
250+
" -V, --verbose Verbose, noisy output suitable for debugging\n"
251+
" -v, --version Display version and exit\n"
252+
" -h, --help Display this help message and exit\n\n"
253+
"Kicks %s every %d sec, loadavg monitor disabled, by default\n\n"
254+
"Most WDT drivers only support 120 sec as lowest timeout, but %s\n"
255+
"tries to set %d sec timeout. Example values above are recommendations\n\n",
256+
__progname, __progname,
257+
WDT_DEVNODE, WDT_DEVNODE, WDT_TIMEOUT_DEFAULT / 2,
258+
__progname, WDT_TIMEOUT_DEFAULT);
252259

253260
return status;
254261
}

0 commit comments

Comments
 (0)