Use static NTP server configuration
Ignore NTP servers provided via DHCP. Enable real-time scheduling for Chrony.
This commit is contained in:
parent
2ab072b254
commit
2a1cf374b3
|
|
@ -1,3 +1,4 @@
|
||||||
include /etc/chrony_dhcp.conf
|
sourcedir /etc/chrony/sources.d
|
||||||
pool pool.ntp.org iburst
|
|
||||||
makestep 0.1 3
|
makestep 0.1 3
|
||||||
|
sched_priority 1
|
||||||
|
cmdport 0
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Configure chrony to use NTP server advertised by DHCP server.
|
|
||||||
#
|
|
||||||
|
|
||||||
configure_ntp() {
|
|
||||||
|
|
||||||
# Do nothing if the DHCP server does not advertise any NTP server.
|
|
||||||
[ -z "$ntpsrv" ] && return
|
|
||||||
|
|
||||||
# Write config snippet with NTP servers.
|
|
||||||
for srv in $ntpsrv ; do
|
|
||||||
echo "server $srv iburst"
|
|
||||||
done > /etc/chrony_dhcp.conf.new
|
|
||||||
|
|
||||||
# Compare to currently configured NTP servers.
|
|
||||||
if ! diff -q /etc/chrony_dhcp.conf /etc/chrony_dhcp.conf.new >/dev/null ; then
|
|
||||||
# Update configuration and restart Chrony.
|
|
||||||
mv /etc/chrony_dhcp.conf.new /etc/chrony_dhcp.conf
|
|
||||||
/etc/init.d/S49chrony reload
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
renew|bound)
|
|
||||||
configure_ntp
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue