-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathprovision-chrony.sh
More file actions
39 lines (28 loc) · 890 Bytes
/
provision-chrony.sh
File metadata and controls
39 lines (28 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
source /vagrant/lib.sh
allow_network="$(ip addr show dev eth1 | awk '/inet / {print $2}')"
# install the NTP daemon.
# see https://chrony.tuxfamily.org/doc/3.5/chrony.conf.html
# see https://chrony.tuxfamily.org/doc/3.5/chronyd.html
# see https://chrony.tuxfamily.org/doc/3.5/chronyc.html
# disable systemd-timesyncd so it doesn't try to sync the time.
# the time sync will be handled by chrony.
systemctl stop systemd-timesyncd
systemctl disable systemd-timesyncd
# install chrony.
apt-get install -y chrony
# configure.
cat >>/etc/chrony/chrony.conf <<EOF
# NB you might need to configure the upstream ntp server pool.
# allow internal network.
allow $allow_network
EOF
# restart chrony for it to pickup the changes.
systemctl restart chrony
# wait for it to sync.
chronyc waitsync
# try chrony.
chronyc tracking
chronyc sources
chronyc clients
chronyc serverstats