sdwd
- SystemD WatchDog crate. Provides simple watchdog notification utilities for easy watchdog
management.
sdwd-test.service:
```service [Unit] Description=sdwd test daemon
[Service] ExecStart=sdwd-test WatchdogSec=30s Restart=on-failure ```
src/main.rs:
```rust extern crate sdwd;
fn main() { let recommendedtimeout = sdwd::recommendedtimeout().unwrap(); println!("Recommended timeout: {:?}", recommendedtimeout); let _ = sdwd::startwatchdogthread(recommendedtimeout);
loop {
use std::thread;
use std::time::Duration;
thread::sleep(Duration::from_secs(5));
println!("Printing this message once in five seconds");
}
} ```
https://www.freedesktop.org/software/systemd/man/systemd.service.html
https://www.freedesktop.org/software/systemd/man/sdwatchdogenabled.html
This project is licensed under the MIT license.