Easy to use daemonizing for rust programs in unix enviroment.
Add to Cargo.toml
:
[dependencies]
unix-daemonize = "0.1"
To src/main.rs
:
extern crate unix_daemonize;
use unix_daemonize::{daemonize_redirect, ChdirMode};
fn main() {
daemonize_redirect(Some("/tmp/stdout.log"), Some("/tmp/stderr.log"), ChdirMode::ChdirRoot).unwrap()
}