Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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