[systemd-devel] alternative approach to waiting for system time to be set
Peter A. Bigot
pab at pabigot.com
Mon Mar 19 01:45:01 UTC 2018
Like others I'd like to use systemd to defer starting a service until
the system time has been set accurately. Previous approaches to
resolving issue #5097 don't seem to be going anywhere.
https://github.com/pabigot/timesyncwait has my proposed solution: a
standalone service that blocks until adjtimex(2) confirms that something
has told the kernel its realtime clock is synchronized. It also provides
a new time-synchronized.target so it can be installed alongside an
unmodified timesyncd.
Initial tests show this meets my needs. I'd be willing to rework it as
a patch to systemd if there's consensus the approach is reasonable.
Peter
Mar 15 17:14:17 raspberrypi3 systemd[1]: Starting Wait Until Kernel Time
Synchronized...
Mar 15 17:14:17 raspberrypi3 timesyncwait[107]: adjtime state 5 status
40 time 1521134057.408590
Mar 19 01:04:35 raspberrypi3 timesyncwait[107]: adjtime state 0 status
2000 time 1521421475.316852
Mar 19 01:04:35 raspberrypi3 systemd[1]: Started Wait Until Kernel Time
Synchronized.
References:
* https://github.com/systemd/systemd/issues/5097
* https://github.com/LukeShu/systemd-timesyncd-wait
*
https://lists.freedesktop.org/archives/systemd-devel/2014-November/025131.html
* https://lists.freedesktop.org/archives/systemd-devel/2017-May/038952.html
More information about the systemd-devel
mailing list