Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 11 days 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 (about 2 years ago)
- Last Synced: 2025-01-20T23:51:12.796Z (22 days 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
[![Github](https://github.com/m-lima/yad/workflows/build/badge.svg)](https://github.com/m-lima/yad/actions?workflow=build)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Cargo](https://img.shields.io/crates/v/yad.svg)](https://crates.io/crates/yad)
[![Documentation](https://docs.rs/yad/badge.svg)](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