On Sat, 15 Jul 2017 22:44:46 +1000, Russell Stuart wrote: > On Sat, 2017-07-15 at 07:46 +0200, Tollef Fog Heen wrote: >> Doesn't something like: >> >> [Unit] >> Description=My hook for foo.link After=foo.link BindsTo=foo.link >> >> [Service] >> Type=oneshot ExecStart=/usr/local/sbin/whatever RemainAfterExit=yes >> >> [Install] >> WantedBy=multi-user.target >> >> work to hook into when a link unit is activated? >> >> (Or just a Wants and Before in the foo.link unit) > > When I discovered .link and .network files the first thing I looked up > in the doco was whether that sort of thing was possible. I decided it > wasn't and wrote it off as useless for me. > > Now you've made me check for real. After setting up the unit files you > suggested I get this message in journalctl: > > Failed to add dependency on foo.link, ignoring: Invalid argument
You'd have to use BindsTo=sys-subsystem-net-devices-blah.device. But BindsTo= and device units are a bit fiddly, see <https://github.com/ systemd/systemd/issues/4413>. -- Sam Morris <https://robots.org.uk/> PGP: rsa4096/CAAA AA1A CA69 A83A 892B 1855 D20B 4202 5CDA 27B9