Daemonize
This commit is contained in:
parent
4fbf3e4663
commit
ced0845c24
3 changed files with 20 additions and 0 deletions
|
|
@ -60,6 +60,15 @@ lazy_static::lazy_static! {
|
|||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
match fork::daemon(false, false) {
|
||||
Ok(fork::Fork::Child) => (),
|
||||
Ok(fork::Fork::Parent(_child_pid)) => process::exit(0),
|
||||
Err(err) => {
|
||||
eprintln!("failed to daemonize: {:?}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init();
|
||||
|
||||
localize::localize();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue