Crate sdwd

Source
Expand description

sdwd - SystemD WatchDog crate. Provides simple watchdog notification utilities for easy watchdog management.

§Usage

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");
    }
}

Functions§

expected_timeout
Returns expected watchdog ping timeout with microseconds precision.
ping_watchdog
Pings the watchdog. Should be called repeatedly within the expected_timeout() interval.
recommended_timeout
According to the documentation of the systemd, it is recommended to ping watchdog every half of the expected_timeout()’s.
start_watchdog_thread
Starts watchdog thread pinging with specified interval.