28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/c3d/util/processes.rb', line 28
def start_ethereum settings
unless is_eth_running?
path = settings["path-to-eth"] || "/opt/cpp-ethereum/build/eth/eth"
port = settings["eth_rpc_port"] || "9090"
peer_port = settings["eth_peer_port"] || "30303"
client_name = settings["eth_client_name"] || "c3d-headless"
remote = settings["eth_remote"] || ""
if remote != ""
remote = "-r #{remote}"
end
dir = settings["blockchain_dir"] || ""
if dir != ""
dir = "-d #{dir}"
end
mine = settings["eth_mine"] || "off"
if mine == ("off" || "false")
mine = "-m off"
elsif mine == ("on" || "true")
mine = "-m on"
end
key = settings["primary_account_key"] || ""
if key != ""
key = "-s #{key}"
end
pid = spawn "#{path} --json-rpc-port #{port} -l #{peer_port} -c #{client_name} #{remote} #{dir} #{mine} #{key}"
sleep 7
at_exit { Process.kill("INT", pid) }
end
end
|