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.targetandAfter=network-online.targetto actually wait for the network to be onlinenetwork-online.serviceunit does not monitor the online state of the system!This only works as a one-time concept during system start-up. The