mirror of
https://github.com/troglobit/finit.git
synced 2026-10-23 11:44:37 +00:00
watchdog: wait for WDT reset only if watchdogd is running
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
79dc6e7472
commit
c85551a42e
2 files changed
+5
-6
No files matched your search
+4
-5
@@ -93,7 +93,8 @@ static int loop(int fd, int timeout)
|
||||
ioctl(fd, WDIOC_KEEPALIVE, &dummy);
|
||||
if (write(fd, "V", 1) == -1)
|
||||
return EX_IOERR;
|
||||
}
|
||||
} else
|
||||
syslog(LOG_ALERT, "System going down ...");
|
||||
|
||||
return EX_OK;
|
||||
}
|
||||
@@ -111,12 +112,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
rc = loop(fd, WDT_TIMEOUT);
|
||||
while (!handover) {
|
||||
syslog(LOG_ALERT, "System going down ...");
|
||||
|
||||
/* Waiting for SIGTERM ... */
|
||||
/* Waiting for SIGTERM or WDT reset ... */
|
||||
sleep(1);
|
||||
|
||||
/* Set lowest possible timeout on SIGTERM */
|
||||
/* Set lowest possible timeout on SIGPWR */
|
||||
ioctl(fd, WDIOC_SETTIMEOUT, &shutdown);
|
||||
}
|
||||
close(fd);
|
||||
|
||||
Reference in new issue
Block a user