]> git.phdru.name Git - ansible.git/blobdiff - playbooks/roles/adjtimex/templates/adjtimex.sh
Feat(adjtimex): Rewrite `adjtimex.sh`
[ansible.git] / playbooks / roles / adjtimex / templates / adjtimex.sh
index 4ee2a4b1676dc1a776bb44ac7463f713402bec87..6d97e51b2e38b0a45710cfdb45642c8501057578 100755 (executable)
@@ -1,24 +1,17 @@
 #! /bin/sh
 
-# Stole some ideas from
-# http://support.ntp.org/bin/view/Support/ManualCalibration
+# Warm up DNS
+host -t ns pool.ntp.org
+host pool.ntp.org
+{% if ansible_facts.os_family == 'Debian' %}
+host 0.debian.pool.ntp.org
+host 1.debian.pool.ntp.org
+host 2.debian.pool.ntp.org
+host 3.debian.pool.ntp.org
+{% endif %}
 
-{ echo; echo; } | adjtimex -l &&
-ntpdate{% if ansible_facts.os_family == 'Debian' %}-debian{% endif %} &&
-{ echo; echo; } | adjtimex -l &&
+ntpdate{% if ansible_facts.os_family == 'Debian' %}-debian{% endif %} -b &&
+hwclock --systohc --update-drift &&
 
-hwclock --systohc &&
-{ echo; echo; } | adjtimex -l &&
-hwclock --hctosys &&
-
-{ echo; echo; } | adjtimex -l &&
-adjtimex -r --adjust &&
-{ echo; echo; } | adjtimex -l &&
-
-freq=`adjtimex -p | awk '/frequency:/ {print $2}'` &&
-tick=`adjtimex -p | awk '/tick:/ {print $2}'` &&
-#adjtimex -f "$freq" -t "$tick" &&
-
-tail -2 /etc/default/adjtimex &&
-sed -i -e "s/^FREQ=.\+$/FREQ=$freq/" -e "s/^TICK=.\+$/TICK=$tick/" /etc/default/adjtimex &&
-exec tail -2 /etc/default/adjtimex
+hwclock --get &&
+exec date