Crate yad

Crate yad 

Source
Expand description

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

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

Re-exports§

pub use options::Stdio;

Modules§

options
Configuration for starting the daemon.

Structs§

ErrorCode
An error that occurs during initialization that can be represented as an i32 and sent through the pipe back to the invoking process error handling.

Enums§

DaemonError
Wrapped errors that can happen after the daemon has forked.
Error
Errors that can happen while daemonizing.

Functions§

daemonize
Starts the daemon with default options.
daemonize_with_init
Starts the daemon with default options executing initialization after forking the process.
with_options
Starts the daemon with the given options.