Reintroduce daemonize.
This commit is contained in:
parent
870731cb9f
commit
7f2acedf9f
@ -19,6 +19,7 @@ ethsync = { path = "sync" }
|
|||||||
ethcore-rpc = { path = "rpc", optional = true }
|
ethcore-rpc = { path = "rpc", optional = true }
|
||||||
fdlimit = { path = "util/fdlimit" }
|
fdlimit = { path = "util/fdlimit" }
|
||||||
target_info = "0.1"
|
target_info = "0.1"
|
||||||
|
daemonize = "0.2"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rpc"]
|
default = ["rpc"]
|
||||||
|
@ -31,6 +31,7 @@ extern crate env_logger;
|
|||||||
extern crate ctrlc;
|
extern crate ctrlc;
|
||||||
extern crate fdlimit;
|
extern crate fdlimit;
|
||||||
extern crate target_info;
|
extern crate target_info;
|
||||||
|
extern crate daemonize;
|
||||||
|
|
||||||
#[cfg(feature = "rpc")]
|
#[cfg(feature = "rpc")]
|
||||||
extern crate ethcore_rpc as rpc;
|
extern crate ethcore_rpc as rpc;
|
||||||
@ -49,6 +50,7 @@ use ethcore::ethereum;
|
|||||||
use ethcore::blockchain::CacheSize;
|
use ethcore::blockchain::CacheSize;
|
||||||
use ethsync::EthSync;
|
use ethsync::EthSync;
|
||||||
use target_info::Target;
|
use target_info::Target;
|
||||||
|
use daemonize::{Daemonize};
|
||||||
|
|
||||||
docopt!(Args derive Debug, "
|
docopt!(Args derive Debug, "
|
||||||
Parity. Ethereum Client.
|
Parity. Ethereum Client.
|
||||||
@ -56,6 +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 [options] [ --no-bootstrap | <enode>... ]
|
parity [options] [ --no-bootstrap | <enode>... ]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -183,6 +186,21 @@ impl Configuration {
|
|||||||
print_version();
|
print_version();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if self.args.cmd_daemon {
|
||||||
|
let daemonize = Daemonize::new()
|
||||||
|
.pid_file("/tmp/parity.pid") // Every method except `new` and `start`
|
||||||
|
.chown_pid_file(true) // is optional, see `Daemonize` documentation
|
||||||
|
.working_directory("/tmp") // for default behaviour.
|
||||||
|
.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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user