Re: systemd-networkd-wait-online doesn't wait for DNS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > Is there a way to tell the systemd-networkd-wait-online service to wait
> > until DNS is working before continuing?  
> 
> There is not, so I built a small tool for this: https://forge.km6g.us/km6g/wait-for-dns
> 
> It doesn't just wait for a DNS resolver to be configured, it waits for a name to be resolvable.

Very nice!  Stealing your idea I tried doing a cut down version of it
as a systemd service and that worked too:

  # /etc/systemd/system/wait-for-dns@.service
  # systemctl enable wait-for-dns@xxxxxxxxxxx.service
  [Unit]
  Description=Wait for DNS to be up
  Before=network-online.target

  # At once a second, give up after this many seconds.
  StartLimitBurst=10

  [Service]
  Type=oneshot
  ExecStart=host %i
  Restart=on-failure
  RestartSec=1

  [Install]
  WantedBy=network-online.target

This does throw up errors during the boot process about the service
failing but if you can live with that, after 2-3 attempts it "starts"
successfully and then everything proceeds as normal.

Now my services running off NFS mounts actually start at bootup!

Cheers,
Adam.



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux