Skip to content

Instantly share code, notes, and snippets.

@toddlipcon
Created July 1, 2014 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toddlipcon/f154717c214996ea79b3 to your computer and use it in GitHub Desktop.
Save toddlipcon/f154717c214996ea79b3 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo Waiting for NTP sync status
start_time=$(cut -f1 -d. /proc/uptime)
delta=0
while ntptime | grep UNSYNC ; do
now=$(cut -f1 -d. /proc/uptime)
delta=$[$now - $start_time]
if [ $delta -gt 600 ]; then
echo NTP time sync never achieved. Failing build.
exit 1
fi
echo NTP not yet synchronized after $delta secs... sleeping
sleep 5
done
echo NTP synchronized after $delta seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment