2 releases (1 stable)

Uses old Rust 2015

1.0.0 Jun 15, 2019
0.1.0 Sep 14, 2018

#596 in Unix APIs

Download history 102/week @ 2024-03-28 193/week @ 2024-04-04 157/week @ 2024-04-11 251/week @ 2024-04-18 230/week @ 2024-04-25 240/week @ 2024-05-02 157/week @ 2024-05-09 398/week @ 2024-05-16 226/week @ 2024-05-23 173/week @ 2024-05-30 309/week @ 2024-06-06 251/week @ 2024-06-13 192/week @ 2024-06-20 237/week @ 2024-06-27 194/week @ 2024-07-04 204/week @ 2024-07-11

886 downloads per month

MIT and LGPL-2.1-or-later WITH GCC-exception-2.0

5KB

sdwd

MIT licensed

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

Usage

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

Read about watchdogs

https://www.freedesktop.org/software/systemd/man/systemd.service.html

https://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html

License

This project is licensed under the MIT license.

Dependencies

~1MB
~16K SLoC