openethereum/scripts/docker/hub/check_sync.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
442 B
Bash
Raw Normal View History

#!/bin/bash
2020-09-22 14:53:52 +02:00
# checks if OpenEthereum has a fully synced blockchain
ETH_SYNCING=$(curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://localhost:8545 -H 'Content-Type: application/json')
RESULT=$(echo "$ETH_SYNCING" | jq -r .result)
if [ "$RESULT" == "false" ]; then
2020-09-22 14:53:52 +02:00
echo "OpenEthereum is ready to start accepting traffic"
exit 0
else
2020-09-22 14:53:52 +02:00
echo "OpenEthereum is still syncing the blockchain"
exit 1
fi