Systemd: Start Service at Boot Time After Network Is Really Up (For Wol Purpose)

systemd: start service at boot time after network is really up (for WoL purpose)

I tried all these targets, and they all were reached before DHCP got an IP address. Go figure:

  • network-online.target
  • remote-fs.target
  • nfs-client.target
  • dbus.service

What did work was enabling these two:

systemctl enable systemd-networkd.service systemd-networkd-wait-online.service

And then setting

After=systemd-networkd-wait-online.service
Wants=systemd-networkd-wait-online.service

Now it got started after DHCP got an IP address. (A mount point in my case, but could have been your service too)

(On debian9/stretch)

Autossh script running as systemctl start SERVICE works but systemctl enable SERVICE failed

Instead of After=network.target, use After=network-online.target.

More about systemd network targets are documented on the systemd wiki page.



Related Topics



Leave a reply



Submit