Updated NTP to list of servers
This commit is contained in:
parent
b047499906
commit
0ca8aa53a0
2 changed files with 29 additions and 1 deletions
|
@ -565,10 +565,23 @@ setHostname() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# @description Sets the NTP server using `m` on macOS
|
# @description Sets the NTP server using `m` on macOS
|
||||||
|
#
|
||||||
|
# `2>/dev/null 1>&2` was added after `sudo systemsetup -setusingnetworktime` calls because the command was outputting the following
|
||||||
|
# useless error:
|
||||||
|
#
|
||||||
|
# ```shell
|
||||||
|
# ### Error:-99 File:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/Admin/InternetServices.m Line:379
|
||||||
|
# ```
|
||||||
setNtpServer() {
|
setNtpServer() {
|
||||||
if command -v m > /dev/null; then
|
if command -v m > /dev/null; then
|
||||||
### macOS
|
### macOS
|
||||||
m ntp set {{ .user.ntpServer }}
|
logg info 'Copying ~/.local/etc/ntp.conf to /etc/ntp.conf'
|
||||||
|
sudo cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/dot_local/etc/ntp.conf" /etc/ntp.conf
|
||||||
|
logg info 'Copying ~/.local/etc/ntp.conf to /private/etc/ntp.conf'
|
||||||
|
sudo cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/dot_local/etc/ntp.conf" /private/etc/ntp.conf
|
||||||
|
logg info 'Turning off setusingnetworktime for 2 seconds' && sudo systemsetup -setusingnetworktime off 2>/dev/null 1>&2
|
||||||
|
sleep 2
|
||||||
|
logg info 'Re-enabling setusingnetworktime' && sudo systemsetup -setusingnetworktime on 2>/dev/null 1>&2
|
||||||
else
|
else
|
||||||
logg warn 'Skipped setting the NTP server'
|
logg warn 'Skipped setting the NTP server'
|
||||||
fi
|
fi
|
||||||
|
|
15
home/dot_local/etc/ntp.conf
Normal file
15
home/dot_local/etc/ntp.conf
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
server 0.pool.ntp.org
|
||||||
|
server 1.pool.ntp.org
|
||||||
|
server 2.pool.ntp.org
|
||||||
|
server ntp2.lrz.de
|
||||||
|
server ntp1.lrz.de
|
||||||
|
server ntp3.lrz.de
|
||||||
|
server ptbtime1.ptb.de
|
||||||
|
server ptbtime2.ptb.de
|
||||||
|
server ptbtime3.ptb.de
|
||||||
|
server ntp1.in.tum.de
|
||||||
|
server ntp2.in.tum.de
|
||||||
|
server time.euro.apple.com
|
||||||
|
server time.apple.com
|
||||||
|
server time.asia.apple.com
|
||||||
|
server time.windows.com
|
Loading…
Reference in a new issue