Created
April 14, 2023 18:50
-
-
Save syuu1228/c80a7fba743194c6601fb83542932d92 to your computer and use it in GitHub Desktop.
ec2_configure_chrony.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import re | |
with open('/etc/chrony/chrony.conf') as f: | |
chrony_conf = f.read() | |
chrony_conf = re.sub(r'^(pool .*$)', '# \\1', chrony_conf, flags=re.MULTILINE) | |
with open('/etc/chrony/chrony.conf', 'w') as f: | |
f.write(chrony_conf) | |
with open('/etc/chrony/sources.d/ntp-pool.sources', 'w') as f: | |
f.write('pool time.aws.com iburst\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment