Avoid changing user for daemonize. Just stick to the basics.

This commit is contained in:
Gav Wood 2016-02-18 13:54:18 +01:00
parent 7f2acedf9f
commit c6bcd464c2

View File

@ -58,7 +58,7 @@ Parity. Ethereum Client.
Copyright 2015, 2016 Ethcore (UK) Limited Copyright 2015, 2016 Ethcore (UK) Limited
Usage: Usage:
parity daemon [options] [ --no-bootstrap | <enode>... ] parity daemon <pid_file> [options] [ --no-bootstrap | <enode>... ]
parity [options] [ --no-bootstrap | <enode>... ] parity [options] [ --no-bootstrap | <enode>... ]
Options: Options:
@ -187,19 +187,11 @@ impl Configuration {
return; return;
} }
if self.args.cmd_daemon { if self.args.cmd_daemon {
let daemonize = Daemonize::new() let daemonize = Daemonize::new().pid_file(self.args.arg_pid_file.clone()).chown_pid_file(true);
.pid_file("/tmp/parity.pid") // Every method except `new` and `start` match daemonize.start() {
.chown_pid_file(true) // is optional, see `Daemonize` documentation Ok(_) => info!("Daemonized"),
.working_directory("/tmp") // for default behaviour. Err(e) => { error!("{}", e); return; },
.user("nobody") }
.group("daemon") // Group name
.group(2) // Or group id
.privileged_action(|| "Executed before drop privileges");
match daemonize.start() {
Ok(_) => info!("Success, daemonized"),
Err(e) => { error!("{}", e); return; },
}
} }
self.execute_client(); self.execute_client();
} }