Crates.io | sdwd |
lib.rs | sdwd |
version | 1.0.0 |
source | src |
created_at | 2018-09-14 12:32:22.229127 |
updated_at | 2019-06-15 07:53:56.973179 |
description | SystemD WatchDog utility crate |
homepage | |
repository | https://github.com/vityafx/sdwd |
max_upload_size | |
id | 84695 |
size | 6,295 |
sdwd
- SystemD WatchDog crate. Provides simple watchdog notification utilities for easy watchdog
management.
sdwd-test.service:
[Unit]
Description=sdwd test daemon
[Service]
ExecStart=sdwd-test
WatchdogSec=30s
Restart=on-failure
src/main.rs:
extern crate sdwd;
fn main() {
let recommended_timeout = sdwd::recommended_timeout().unwrap();
println!("Recommended timeout: {:?}", recommended_timeout);
let _ = sdwd::start_watchdog_thread(recommended_timeout);
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/sd_watchdog_enabled.html
This project is licensed under the MIT license.