diff --git a/etc/ntpd-time.conf b/etc/ntpd-time.conf new file mode 100644 index 0000000..8001ef7 --- /dev/null +++ b/etc/ntpd-time.conf @@ -0,0 +1,22 @@ +# Note: This is only for time.molgen.mpg.de@wtf + +interface ignore wildcard +interface listen 141.14.16.215 # time.molgen.mpg.de +interface listen 127.0.0.1 # for ntpq + +server ntps1.gwdg.de iburst +server ntps2.gwdg.de iburst +server ntps3.gwdg.de iburst +server ntps4.gwdg.de iburst +server zeit.fu-berlin.de iburst +server ntps1-0.cs.tu-berlin.de iburst +server ptbtime1.ptb.de iburst +server ptbtime2.ptb.de iburst +server ptbtime3.ptb.de iburst +server 0.de.pool.ntp.org iburst +server 1.de.pool.ntp.org iburst + +driftfile /var/cache/ntp.drift + +restrict default nomodify noquery notrap nopeer +restrict 127.0.0.1 diff --git a/etc/systemd/system/ntp-clock-stamp.service b/etc/systemd/system/ntp-clock-stamp.service new file mode 100644 index 0000000..cb8b080 --- /dev/null +++ b/etc/systemd/system/ntp-clock-stamp.service @@ -0,0 +1,13 @@ +[Unit] +ConditionHost=wtf.molgen.mpg.de +After=ntpd-time.service +BindsTo=ntpd-time.service + +[Service] +Type=exec +ExecStartPre=/usr/bin/mkdir -p /var/lib/systemd/timesync +ExecStart=/bin/bash -c 'while true; do out=$(ntpq -c "rv 0 leap" 2>/dev/null); [[ $out =~ leap=(00|01|10) ]] && touch /var/lib/systemd/timesync/clock; sleep 60; done' +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/etc/systemd/system/ntpd-time.service b/etc/systemd/system/ntpd-time.service new file mode 100644 index 0000000..2ccfdd7 --- /dev/null +++ b/etc/systemd/system/ntpd-time.service @@ -0,0 +1,18 @@ +[Unit] +ConditionHost=wtf.molgen.mpg.de +DefaultDependencies=no +After=systemd-sysusers.service +Before=time-set.target sysinit.target shutdown.target +Conflicts=shutdown.target +Wants=time-set.target + +[Service] +ExecStart=/usr/bin/ntpd -n -g -c /etc/ntpd-time.conf +Restart=always + +# ntpd logs to syslog, stdout/stderr is redundant +StandardOutput=null +StandardError=null + +[Install] +WantedBy=basic.target diff --git a/etc/systemd/system/systemd-timesyncd.service.d/not-on-wtf.conf b/etc/systemd/system/systemd-timesyncd.service.d/not-on-wtf.conf new file mode 100644 index 0000000..09685a5 --- /dev/null +++ b/etc/systemd/system/systemd-timesyncd.service.d/not-on-wtf.conf @@ -0,0 +1,6 @@ +# Don't start systemd-timesyncd on wtf, because on this host we start +# ntpd-time.service which regulates the kernel real time clock. + +[Unit] + +ConditionHost=!wtf.molgen.mpg.de diff --git a/etc/systemd/timesyncd.conf.d/local.conf b/etc/systemd/timesyncd.conf.d/local.conf new file mode 100644 index 0000000..66f3a21 --- /dev/null +++ b/etc/systemd/timesyncd.conf.d/local.conf @@ -0,0 +1,7 @@ +[Time] + +# several fallbacks. systemd-timesyncd will use the first responding server and stick +# to it as long as it is reachable or until restarted. +# test remote with `ntpdate -q SERVER` (no change of local time) + +NTP=time.molgen.mpg.de ntps1.gwdg.de ntps2.gwdg.de ntps3.gwdg.de ntps4.gwdg.de zeit.fu-berlin.de ntps1-0.cs.tu-berlin.de ptbtime1.ptb.de ptbtime2.ptb.de ptbtime3.ptb.de 0.de.pool.ntp.org 1.de.pool.ntp.org