cardano-docker/scripts/functions/wait_for_sync
2021-02-13 10:19:38 -05:00

17 lines
446 B
Plaintext

function wait_for_sync {
source /scripts/functions/wait_for_socket
wait_for_socket
WAIT_FOR_SYNC=$1
echo "Waiting for node to sync to atleast ${WAIT_FOR_SYNC}%"
while true; do
SYNC_PCT=$(sync_status | tr ' ' '\n' | tail -1 | sed 's/%//g' | bc)
sync_status
if [[ (($SYNC_PCT > $WAIT_FOR_SYNC)) ]]; then
echo "Reached ${SYNC_PCT}%"
break
fi
sleep 10
done
}