Skip to content

Instantly share code, notes, and snippets.

@sean-smith
Last active February 22, 2024 04:31
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 sean-smith/3288d8f3f0f1a293036d9f8e3ac3c9a1 to your computer and use it in GitHub Desktop.
Save sean-smith/3288d8f3f0f1a293036d9f8e3ac3c9a1 to your computer and use it in GitHub Desktop.
#!/bin/bash
# run as root, then validate with:
# chronyc sources -v
# chronyc tracking
# see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html#configure-time-sync
apt install -y chrony
sed -i '/\# See http:\/\/www.pool.ntp.org\/join.html for more information./a server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4\npool time.aws.com iburst' /etc/chrony/chrony.conf
systemctl enable --now chrony
/etc/init.d/chrony restart
@sean-smith
Copy link
Author

Validate with:

srun -N 63 bash -c 'echo "$(hostname): $(date)"' | sort -k2,3

@verdimrc
Copy link

To use Amazon Time Sync Service:

sed -i '/\# See http:\/\/www.pool.ntp.org\/join.html for more information./a server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4\npool time.aws.com iburst' /etc/chrony/chrony.conf

@verdimrc
Copy link

verdimrc commented Feb 22, 2024

Instead of start, do systemctl enable --now chrony.

@sean-smith
Copy link
Author

Updated, thanks @verdimrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment