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

Debraj Manna subharaj.manna at gmail.com
Tue Apr 2 09:17:38 UTC 2019


Thanks for replying. Below is the service file for ntpd

support at vrni-platform:/etc/init.d$ sudo systemctl cat ntp.service
# /run/systemd/generator.late/ntp.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/ntp
Description=LSB: Start NTP daemon
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=network-online.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Wants=network-online.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/ntp start
ExecStop=/etc/init.d/ntp stop



On Tue, Apr 2, 2019 at 1:48 PM Lennart Poettering <lennart at poettering.net>
wrote:

> On Di, 02.04.19 10:05, Reindl Harald (h.reindl at thelounge.net) wrote:
>
> > Am 02.04.19 um 09:44 schrieb Debraj Manna:
> > >
> > >   We have a service that starts at boot. We need to ensure it doesn't
> > >   start until the system clock has been synchronized via ntp. The
> > >   machines are using |ntpd|
> >
> > After=ntpd.service
> > Wants=ntpd.service
>
> I don't know ntpd. But I surely hope that just starting ntpd will
> delay boot-up until a sync is reached. If it does, then this would be
> a bug and a misdesign in the ntpd unit files.
>
> (See my other mail how ntpd should do this correctly.)
>
> Lennart
>
> --
> Lennart Poettering, Berlin
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190402/0f9ba624/attachment.html>


More information about the systemd-devel mailing list