Bug#727708: init system thoughts
]] Russ Allbery
> That, however, is also a good point. This specific case is the place
> where an event model does have a clear advantage. It looks like the
> preferred strategy in the systemd model is to teach daemons to watch for
> this themselves, which while certainly a good idea (most high-quality UDP
> daemons I know of that care about binding to specific interfaces do in
> fact do this), is decidedly non-trivial and hard to do portably if the
> daemon doesn't already support it. Freebind sockets get one out of a lot
> of the places where this is needed, but not all of them.
I believe you can do this fairly easily.
A is the service that needs to be reloaded when a network device shows
up. In A's service file, have ReloadPropagatedFrom=network.target and
then make your ifup@.service include an ExecStart=systemctl reload
network.target. You probably want the same for ExecStop too, to handle
interfaces going away.
Another alternative is having multiple instance services and using
BindTo=sys-subsystem-net-devices-%i.device (like ifup@.service is
doing).
--
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are
Reply to: