[systemd-devel] How to ensure a systemd unit waits for ntpd to sync before starting?

Lennart Poettering lennart at poettering.net
Tue Apr 2 10:32:58 UTC 2019


On Di, 02.04.19 11:58, Marc Haber (mh+systemd-devel at zugschlus.de) wrote:

> On Tue, Apr 02, 2019 at 10:17:26AM +0200, Lennart Poettering wrote:
> > Well packaged NTP servers should have a separate .service unit that
> > waits until an NTP sync is reached. For example, systemd's own
> > systemd-timesyncd.service comes with a companion
> > systemd-time-wait-sync.service that does this.
>
> systemd-time-wait-sync.service invokes
> /lib/systemd/systemd-time-wait-sync do to the actual wait, which is an
> ELF binary. While this is a valid approach to do this, an interested
> used will now need to download the systemd souces, unpack them, search
> for the source for the binary just to find out what this service
> actually does.
>
> To adapt it to wait for something else, one needs to whack out a
> compiler.
>
> IMO, this is a classic case of "doing this scripted is way easier and
> more flexible". Please consider for the future.

You cannot correctly do what systemd-time-wait-sync does from a
shell. Sorry.

I thought people have noticed by now that systemd is really about
removing unnecessary shell scripts from all clean system boot
codepaths.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list