Daemonize server with proper working directory. (#289)

This commit is contained in:
Carl Dong 2017-11-17 03:55:49 -08:00 committed by Yeastplume
parent 10380c0ce0
commit efb41596b2

View file

@ -34,6 +34,7 @@ use std::thread;
use std::io::Read;
use std::fs::File;
use std::time::Duration;
use std::env::current_dir;
use clap::{App, Arg, ArgMatches, SubCommand};
use daemonize::Daemonize;
@ -333,6 +334,7 @@ fn server_command(server_args: &ArgMatches, global_config: GlobalConfig) {
let daemonize = Daemonize::new()
.pid_file("/tmp/grin.pid")
.chown_pid_file(true)
.working_directory(current_dir().unwrap())
.privileged_action(move || {
grin::Server::start(server_config.clone()).unwrap();
loop {