В Thu, 22 Jan 2015 16:44:52 +0100 Igor Bukanov <[email protected]> пишет:
> For a service that should be shutdown when network is not available, I > tried to use Requires=network-online.target . However, on Fedora 21 > with NetworkManager that does not work. When I switch off WiFi, the > only connection on my laptop that can configure default IP route and > setup /etc/resolv.conf, network-online.target still stays active and > my service continues to run. Is it a bug in Fedora? If not, what is a > canonical way to implement such dependency? No, it is not a bug. network-online was never intended to be used this way. It was intended to be used only during startup; when initial startup is finished, state of this service is largely irrelevant. network-online.target itself does absolutely nothing. It is provided as well known name for other services to order itself after; and you need to provide implementation that orders itself before. For NM implementation would be NetworkManager-wait-online.service that basically does nothing more than calling nm-online. Note that "network down" does not cause any change state in systemd. NetworkManager still runs. systemd itself does not watch or manages network, so it cannot initiate any actions here. I suppose you really want to hook systemctl stop/systemctl start in NetworkManager dispatcher framework. _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
