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
How to Prefill Command Line Input
How to Capture Network Frames in a Kernel Module
The Meaning of Real, User, and Sys in Output of Linux Time Command
Systemd: "Environment" Directive to Set Path
Shell Script Working Fine Without Shebang Line? Why
How to Prevent Out of Memory (Oom) Freezes on Linux
Ssh Command Execution Hangs, Although Interactive Shell Functions Fine
How to Remove Warning About Storing Unencrypted Password After Committing File in Svn
Can't Run Uwsgi as Root, "Bind(): Permission Denied"
Find and Delete Files with Non-Ascii Names
How to Echo a Sum of a Variable and a Number
Compile Programs on Multicore or Distributed System
Using Environment Variables in Curl Command - Unix
Why Glibc and Pthread Library Both Defined Same APIs
How to Programmatically Set a Permanent Environment Variable in Linux
Difference Between -Shared and -Wl,-Shared of the Gcc Options
Why Gcc 4.X Default Reserve 8 Bytes for Stack on Linux When Calling a Method