It appears the systemd script runs before the network interface has been renamed from eth0 to enp1s0.
In that case, make the systemd unit depend on a network interface named enp1s0
. This is done by adding Wants=
and After=
for the corresponding /sys device path – though somewhat confusingly, systemd uses the made-up /sys/subsystem path for this (which was planned to come into existence but never did).
[Unit]
Wants=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
Also, while having the unit in multi-user.target is generally fine, you could make the device itself pull it in:
# Optional
[Install]
WantedBy=sys-subsystem-net-devices-%i.device
An even better method would be to invoke ethtool from a udev rule, as udev rules are processed when the device shows up and no earlier (obviously). In other situations (though not in yours) they also have the advantage that various other software (including systemd) is only notified of the device being "ready" after rule processing has finished.
# /etc/udev/rules.d/20-wol.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*", RUN+="/sbin/ethtool -s %k wol g"
I think what will work is to set the systemd unit to run at the end.
There is no "at the end" in systemd, very deliberately. There are things that approximate it, but those are not what you want.