51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/c3d/util/processes.rb', line 51
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 = ENV['ETH_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 15
at_exit { Process.kill("INT", pid) }
end
end
|