I would like to write a systemd service that depends on USB WiFi dongle being present. It doesn't need to start when device is plugged in as long as it doesn't start when device is not plugged in. How can I achieve this?
The systemd configruation file is in network@.conf format. It uses the the
%i placeholder. So I tried adding this to the unit file:
[Path] PathExists = /dev/%i
%i would be something like
wlan0. Unfortunately, this gets completely ignored, so I might not understand the proper use of this section.
I've also tried:
[Unit] .... BindsTo=sys-subsystem-net-devices-%i.device After=sys-subsystem-net-devices-%i.device
I it picked up from somewhere (I forgot where), and that doesn't work either.