https://github.com/iddm/sdwd
SystemD WatchDog Rust utility crate
https://github.com/iddm/sdwd
crates-io daemon rust systemd watchdog
Last synced: 7 months ago
JSON representation
SystemD WatchDog Rust utility crate
- Host: GitHub
- URL: https://github.com/iddm/sdwd
- Owner: iddm
- License: mit
- Created: 2018-09-14T12:28:58.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-05T17:31:06.000Z (almost 2 years ago)
- Last Synced: 2025-03-05T03:19:40.820Z (7 months ago)
- Topics: crates-io, daemon, rust, systemd, watchdog
- Language: Rust
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# sdwd
[](https://crates.io/crates/sdwd)
[](https://docs.rs/sdwd)
[](./LICENSE)`sdwd` - SystemD WatchDog crate. Provides simple watchdog notification utilities for easy watchdog
management.# Usage
*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 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.htmlhttps://www.freedesktop.org/software/systemd/man/sd_watchdog_enabled.html
## License
This project is [licensed under the MIT license](https://github.com/iddm/sdwd/blob/master/LICENSE).