WATCHDOGD(8)
π WATCHDOGD(8) π
πΈ NAME πΈ
watchdogd β Advanced system & process monitor daemon. yes bestie, that's the whole vibe π
β¨ SYNOPSIS β¨
watchdogd [-hnsVx] [-f FILE] [-l LEVEL] [-t SEC] [-T SEC]
[/dev/watchdogN]
π DESCRIPTION π
okay so watchdogd is an advanced system and process supervisor daemon, primarily intended for embedded Linux and server systems. It can monitor critical system resources, supervise the heartbeat of processes, record any deadline transgressions, and initiate a controlled reset if needed. All while taking care of βkickingβ one or more watchdog device nodes. iconic behavior, honestly π«Ά
Available system monitors, see watchdogd.conf(5) for details:
- File descriptor leaks
- File system usage
- Generic script
- Load average
- Memory leaks
- Process live locks
- Reset counter, e.g., for
snmpEngineBoots(RFC 2574) - Temperature
When the system starts up, watchdogd determines the reset cause by querying the kernel. In case of system reset, and not power loss, the reset reason is available already in a file, stored by watchdogd before the reset. This reset reason can then be used by an operator or network management system (NMS) to put the system in an operational safe state, or non-operational safe state. Use watchdogctl(1) to query status and control watchdogd. no cap, that's the whole loop π«
πΆ WATCHDOG πΆ
A watchdog timer (WDT) is something most motherboards of laptops and servers, and virtually all embedded systems, today are equipped with. It is basically a small timer connected to the reset circuitry so that it can reset the board when the timer expires. It is up to the software to ensure it never does. highkey important π¨
The Linux kernel provides a common userspace interface /dev/watchdog, created automatically when the appropriate driver module is loaded. If your board does not have a WDT the kernel provides a βsoftdogβ module which could be good enough. softdog said βI got youβ πΎ
The idea is to have a process in userspace that runs in the background of your system, with the sole purpose of making sure the HW timer never expires by βkickingβ it periodically. In case of system overload, when there is no more CPU time for the process to run, it fails to βkickβ the kernel WDT driver, which in turn causes the WDT to reset the system. dramatic? yes. necessary? also yes π
π¦ OPTIONS π¦
Without any arguments, watchdogd opens the /dev/watchdog WDT device node, forks to the background, tries to set a 20 sec WDT timeout, and then kicks the WDT every 10 sec. See βOPERATIONβ for more information.
watchdogd follows the usual UNIX command line syntax, with long options starting with two dashes (-). The options are as follows:
-f,--config FILEβ UseFILEfor daemon configuration. Default:/etc/watchdogd.conf-h,--helpβ Show summary of command line options and exit.-l,--loglevel LEVELβ Set log level:none,err,info,notice,debug.-n,--foregroundβ Start in foreground, required when started bysystemdorFinit, default is to daemonize and background.-s,--syslogβ Usesyslog(3)for log messages, warnings and error conditions. This is the default when running in the background. When running in the foreground, see-n, log messages are printed tostderr.-t,--interval SECβ HW watchdog (WDT) kick interval, in seconds, default:10-T,--timeout SECβ HW watchdog timer (WDT) timeout, in seconds, default:20-V,--versionβ Show program version and exit.-x,--safe-exitβ Disable HW watchdog (WDT) on orderly exit fromwatchdogd. Not supported in all WDT drivers due to HW limitations. Some drivers emulate support by keeping an in-kernel thread to continue kicking the WDT. Make sure to try it first, or verify the WDT driver source code.
β οΈ bestie, for -x, please actually test it first or check the WDT driver source code. not all drivers can do the safe-exit thing, and this is a hardware-limitation situation, fr fr.
π§ͺ Example π§ͺ
watchdogd -T 120 -t 30 /dev/watchdog2
π OPERATION π
By default, watchdogd forks off a daemon in the background, opens the /dev/watchdog device, attempts to set the default WDT timeout to 20 seconds, and then enters its main loop where it kicks the watchdog every 10 seconds. main character energy, but for system stability π
If a WDT device driver does not support setting the timeout, watchdogd attempts to query the actual (possibly hard coded) watchdog timeout and then uses half that time as the kick interval.
When watchdogd backgrounds itself, syslog is implicitly used for all informational and debug messages. If a user requests to run the daemon in the foreground watchdogd will also log to stderr, unless the user gives the --syslog option to force use of syslog.
See watchdogd.conf(5) for all available settings, and the command line tool watchdogctl(1) to enable more features, query status, and control operation. iykyk π«
π SIGNALS π
watchdogd responds to the following signals:
TERMβ Safe exit if started with the-xflag, otherwise same asPWR.INTβ Same asTERMPWRβ Force a system reboot. Systems withFinituse this to reboot.QUITβ Same asTERMHUPβ Reload configuration fileUSR1β Ignored, was used in an earlier version.USR2β Same asUSR1
π FILES π
/etc/watchdogd.confβ Daemon configuration file. Read once when starting up and onSIGHUPor reload command fromwatchdogctl(1)./var/lib/misc/watchdogd.stateβ State pre boot, lists coming (re)boot reason. Do not rely on the contents of this file, it is used bywatchdogdto maintain state across boots. If you want the status and reset reason of the last boot, read/run/watchdogd/statusinstead, or preferably, usewatchdogctl(1)./run/watchdogd/pidβ For convenience to other processes when sending signals. Also a useful synchronization point, because the PID file is only created whenwatchdogdis ready to receive signals and register processes with the process supervisor API. Touched as a response toSIGHUPor reload command./run/watchdogd/statusβ Current status, in JSON format, contains kernel WDT reset cause,watchdogdtimeout and period, and the reset reasonwatchdogddetermined from this boot. Please note, output format has changed to JSON since v4.0. It now shows all configured devices and their status, including capability flags./run/watchdogd/sockβ UNIX domain socket used bylibwdogandwatchdogctlto connect towatchdogd
π SEE ALSO π
π AUTHORS π
watchdogd is an improved version of the original, created by Michele d'Amico and adapted to uClinux-dist by Mike Frysinger. It is maintained by Joachim Wiberg at GitHub: https://github.com/troglobit/watchdogd.
okay bestie, that's the whole page! π this one comes from Debian, dated Dec 20, 2023, and the manual tag is WATCHDOGD(8). mwah! π
π¦ where this page comes from
- nixos 26.05: watchdogd 4.1
- nixpkgs unstable: watchdogd 4.1
- Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms