]> git.phdru.name Git - ansible.git/blob - playbooks/roles/adjtimex/templates/adjtimex.sh
Feat(adjtimex): Warm up DNS
[ansible.git] / playbooks / roles / adjtimex / templates / adjtimex.sh
1 #! /bin/sh
2
3 # Stole some ideas from
4 # http://support.ntp.org/bin/view/Support/ManualCalibration
5
6 # Warm up DNS
7 host -t ns pool.ntp.org
8 host pool.ntp.org
9 {% if ansible_facts.os_family == 'Debian' %}
10 host 0.debian.pool.ntp.org
11 host 1.debian.pool.ntp.org
12 host 2.debian.pool.ntp.org
13 host 3.debian.pool.ntp.org
14 {% endif %}
15
16 { echo; echo; } | adjtimex -l &&
17 ntpdate{% if ansible_facts.os_family == 'Debian' %}-debian{% endif %} &&
18 { echo; echo; } | adjtimex -l &&
19
20 hwclock --systohc &&
21 { echo; echo; } | adjtimex -l &&
22 hwclock --hctosys &&
23
24 { echo; echo; } | adjtimex -l &&
25 adjtimex -r --adjust &&
26 { echo; echo; } | adjtimex -l &&
27
28 freq=`adjtimex -p | awk '/frequency:/ {print $2}'` &&
29 tick=`adjtimex -p | awk '/tick:/ {print $2}'` &&
30 #adjtimex -f "$freq" -t "$tick" &&
31
32 tail -2 /etc/default/adjtimex &&
33 sed -i -e "s/^FREQ=.\+$/FREQ=$freq/" -e "s/^TICK=.\+$/TICK=$tick/" /etc/default/adjtimex &&
34 exec tail -2 /etc/default/adjtimex