Skip to content

Instantly share code, notes, and snippets.

@ls-avanier
Last active November 23, 2016 19:51
Show Gist options
  • Save ls-avanier/52ee23c4808434c022e5c70d86fc1332 to your computer and use it in GitHub Desktop.
Save ls-avanier/52ee23c4808434c022e5c70d86fc1332 to your computer and use it in GitHub Desktop.
Force synchronization of time on the retail VM
# This chunk will run in your favourite Ubuntu vm
if [[ $(uname) == 'Linux' && $(test -f /usr/bin/apt-get) ]]; then
sudo apt-get update
sudo apt-get install ntp
sudo service ntp stop
sudo ntpdate -s ca.pool.ntp.org
sudo service ntp start
fi
# This chunk will run in your favourite CentOS vm
if [[ $(uname) == 'Linux' && $(test -f /usr/bin/yum) ]]; then
sudo systemctl stop ntpd
sudo ntpdate -s ca.pool.ntp.org
sudo systemctl start ntpd
fi
# This chunk will run on your computer running OSX
if [[ $(uname) == 'Darwin' ]]; then
sudo systemsetup -setnetworktimeserver ca.pool.ntp.org
sudo systemsetup -gettime
fi
# This will run on your computer running Windows
if [[ $(cmd /c ver) ]]; then
shutdown /s /t 0 /p:0:0 /c "This computer is not running a *nix OS, shutting down."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment