2 releases (1 stable)

Uses old Rust 2015

1.0.0 Jun 15, 2019
0.1.0 Sep 14, 2018

#617 in Unix APIs

Download history 187/week @ 2024-07-22 218/week @ 2024-07-29 207/week @ 2024-08-05 307/week @ 2024-08-12 267/week @ 2024-08-19 272/week @ 2024-08-26 188/week @ 2024-09-02 214/week @ 2024-09-09 244/week @ 2024-09-16 240/week @ 2024-09-23 462/week @ 2024-09-30 307/week @ 2024-10-07 235/week @ 2024-10-14 303/week @ 2024-10-21 231/week @ 2024-10-28 282/week @ 2024-11-04

1,075 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