-
Notifications
You must be signed in to change notification settings - Fork 4
/
start.sh
36 lines (31 loc) · 961 Bytes
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
wait_for_node() {
ETH_SYNCING=$(curl -s -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' $WEB3_PROVIDER_URL -H 'Content-Type: application/json')
RESULT=$(echo "$ETH_SYNCING" | jq -r .result)
if [ "$RESULT" == "false" ]; then
echo "Node is ready to start accepting traffic"
exit 0
elif [ "$MODE" = "offline" ]; then
echo "Node in offline mode"
exit 0
else
echo "Node is not ready to start accepting traffic"
sleep 1
wait_for_node
fi
}
if [ "$MODE" = "offline" ]; then
mode="offline"
else
mode="active"
fi
if [ "$NETWORK" = "mainnet" ]; then
chain="EnergyWebChain.json"
else
chain="Volta.json"
fi
openethereum --config /parity/config/parity.toml --chain /parity/config/$chain --mode $mode --logging="${LOG_LEVEL:-info}" &
wait_for_node &
process_id=$!
wait -n $process_id
forever --minUptime 5000 --spinSleepTime 3000 /bin/ewc-rosetta/dist/main.js