cardano-docker/scripts/functions/wait_for_sync

17 lines
446 B
Plaintext
Raw Permalink Normal View History

2021-02-13 15:19:38 +00:00
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
}