systemd systemd-unit systemd-service network
Source
-
use
BindsTo=
andAfter=
in the[Unit]
section andWantedBy=
in[Install]
[Unit] Description=Service depending on interface %I Wants=network-online.target BindsTo=sys-subsystem-net-devices-%i.device After=multi-user.target sys-subsystem-net-devices-%i.device network-online.target [Service] Type=simple ExecStart=... [Install] WantedBy=default.target sys-subsystem-net-devices-%i.device
-
use
Wants=network-online.target
andAfter=network-online.target
to actually wait for the network to be onlinenetwork-online.service
unit does not monitor the online state of the system!This only works as a one-time concept during system start-up. The