Bug#727708: init system thoughts
]] Steve Langasek
> > In any case, systemd does indeed "support" this case; simply make your
> > service depend on network-online.target, which will block for a
> > reasonable amount of time to see if a network interface comes online,
> > and eventually time out if that doesn't occur. This will actually work
> > even if your primary network is a wireless network managed by
> > NetworkManager, and even if that network doesn't actually work until the
> > user has logged in, assuming your service is not actually in the
> > dependency path of the user logging in.
>
> And what makes this work in the case where you *aren't* using
> NetworkManager? I see no integration with ifupdown in the systemd package.
There is none, and it would not be ifupdown-specific. We could easily
enough add a «wait for a default ipv4 and ipv6 default route to appear»
unit if somebody desired that, which would be pulled in by
network-online.target. It's a pretty trivial piece of code.
Alternatively, just put systemctl start network-online.target into a
fragment in if-up.d if you consider ifup considering a network interface
up to be enough. (I don't, but as pointed out on the systemd wiki page
referenced, people have different ideas about what «network online»
means.)
--
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are
Reply to: