Hello Guus, Guus Sliepen [2015-12-10 15:12 +0100]: > Anyway, if we are going for a script that polls stuff, then why not > decouple it completely from ifupdown or whatever networking framework is > used, and do the following? > > #!/bin/sh > TIMEOUT=30 > > offline() { > ip -4 r s | grep -q ^default && return 1 > ip -6 r s | grep -q ^default && return 1 > return 0 > } > > i=0 > while offline; do > if [ $i = $TIMEOUT ] ; then > break > fi > i=$(($i+1)) > sleep 1 > done > > Which is just waiting until we have a default route.
As Tollef already said, this would limit the notion of "online" to "default route" which might not always be true. At the same time it might also not be sufficient as AFAIUI this would be content with an IPv4 *or* IPv6 route, and your network config might require both. Both {NetworkManager,systemd-networkd}-wait-online already know which interfaces should be configured how, and thus can say exactly when the interfaces are in the desired state. They also don't need to poll, but instead just read events from D-Bus. In order to not deviate too much from this schema, I'd prefer ifupdown-wait-online to do the same, i. e. wait until all "ifup"s of your "auto" interfaces are done. This will respect the configuration and not second-guess the admin. Thus in practical terms this indeed should mean nothing else than "networking.service is running", no? So at first sight just adding a WantedBy=network-online.target now makes sense, as it will do just that and not block sysinit.target any more. Thanks! Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
signature.asc
Description: Digital signature
_______________________________________________ Pkg-systemd-maintainers mailing list Pkg-systemd-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers