```rust use core::time::Duration; use daemon_ctrl::{ctrl, WatchConfig};
const CTRL_FILE: &str = "a/a/a/a";
fn main() { let mut cfg = WatchConfig::new(); cfg.autorestart(true); cfg.setctrlfile(String::from(CTRLFILE)).unwrap();
if let Ok(is_parent) = ctrl(cfg) {
if is_parent {
println!("into daemon.");
std::process::exit(0);
}
} else {
println!("not support");
}
// your program
} ```
```rust use daemon_ctrl::Contral;
const CTRL_FILE: &str = "a/a/a/a";
fn main() { let mut ctrl = Contral::read(CTRLFILE); println!("now: {:?}", ctrl); ctrl.reboot = true; ctrl.save(CTRLFILE); } ```