2 个版本 (1 个稳定版)
使用旧的 Rust 2015
1.0.0 | 2019年6月15日 |
---|---|
0.1.0 | 2018年9月14日 |
#542 in Unix APIs
822 每月下载量
5KB
sdwd
sdwd
- SystemD WatchDog 库。提供简单的看门狗通知工具,便于进行看门狗管理。
使用方法
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
许可协议
本项目采用MIT 许可协议。
依赖项
~1MB
~16K SLoC