mirror of
https://github.com/troglobit/finit.git
synced 2026-10-21 11:29:42 +00:00
Add support for registering a watchdog daemon
This patch adds initial support for registering a watchdog daemon with Finit. Needed for situations when you want the system to actually be rebooted by the watchdog timer (WDT) circuitry rather than the kernel. The initctl API has been extended with a INIT_CMD_WDOG_HELLO command that is used to both register and "ping" Finit periodically. As long as Finit responds (with an ACK) the watchdog daemon knows Finit is alive. At shutdown Finit stops all services (except kernel threads and daemons marked with @ in the first character of their process name) and, if a watchdog has registered, SIGPWR is sent to it when Finit has finished unmounting etc., just prior to kernel reboot/halt/poweroff. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
5cde809909
commit
6cb3d86cd1
4 files changed
+25
No files matched your search
@@ -194,6 +194,15 @@ void do_shutdown(shutop_t op)
|
||||
/* Call mdadm to mark any RAID array(s) as clean before halting. */
|
||||
mdadm_wait();
|
||||
|
||||
/* Wait here until the WDT reboots, or timeout */
|
||||
if (wdogpid) {
|
||||
int timeout = 10;
|
||||
|
||||
print(kill(wdogpid, SIGPWR) == 1, "Pending watchdog reboot");
|
||||
while (timeout--)
|
||||
do_sleep(1);
|
||||
}
|
||||
|
||||
_d("%s", op == SHUT_REBOOT ? "Rebooting" : "Halting");
|
||||
if (op == SHUT_REBOOT)
|
||||
reboot(RB_AUTOBOOT);
|
||||
|
||||
Reference in new issue
Block a user