https://github.com/m-lima/yad
Yet Another Daemonizer is a daemonizing crate to easily, simply, and correctly create legacy daemons
https://github.com/m-lima/yad
daemon rust unix
Last synced: 4 months ago
JSON representation
Yet Another Daemonizer is a daemonizing crate to easily, simply, and correctly create legacy daemons
- Host: GitHub
- URL: https://github.com/m-lima/yad
- Owner: m-lima
- License: mit
- Created: 2020-10-30T11:49:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-15T22:54:10.000Z (over 2 years ago)
- Last Synced: 2025-03-01T23:54:05.806Z (4 months ago)
- Topics: daemon, rust, unix
- Language: Rust
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yet Another Daemonizer
[](https://github.com/m-lima/yad/actions?workflow=build)
[](LICENSE)
[](https://crates.io/crates/yad)
[](https://docs.rs/yad)Yet Another Daemonizer is a daemonizing crate to easily, simply, and **correctly** create legacy daemons.
This crate focuses on manually creating a background process which is not managed by a supervisor such as systemd or launchd. It strives to follow all the best practices to correctly daemonize a process.
## Example
```rust
use yad::Stdio;match yad::with_options()
.stdin(Stdio::Null)
.stderr(Stdio::Null)
.stdout(Stdio::output("/var/log/daemon.log"))
.daemonize()
{
Ok(_) => println!("I'm a daemon"),
Err(err) => eprintln!("Failed to launch daemon: {}", err),
}
```## References
- [Man page for daemon()][__link0]
- [Reference project in C][__link1][__link0]: https://man7.org/linux/man-pages/man7/daemon.7.html
[__link1]: https://chaoticlab.io/c/c++/unix/2018/10/01/daemonize.html