[systemd-devel] network consuming user services

David Strauss david at davidstrauss.net
Wed May 2 15:40:57 PDT 2012


On Wed, May 2, 2012 at 1:19 PM, Sebastian Tramp
<mail at sebastian.tramp.name> wrote:
> Are there existing service files which solve a similar or the same issue?

You may want a target [1]. There is already a network target, but I
believe it comes up before NetworkManager fully initializes all
interfaces. I would consider adding a script that fires
network-fully-up.target once NetworkManager finishes [2]. This would
allow any service to install as "WantedBy" that target.

It's probably also possible to stop the network-fully-up.target on
disconnection. If services indicating WantedBy=network-fully-up.target
also have StopWhenUnneeded enabled, they will shut down on stopping
that target.

Altogether, this should do what you need as well as provide a general
facility on your systems for any unit to start and stop based on
network availability.

Note: For a target like network-fully-up, it would be bad to try and
use systemctl isolate in the same way as for the runlevels.

[1] http://0pointer.de/public/systemd-man/systemd.target.html
[2] http://drewdahl.com/2011/05/03/using-networkmanager-to-run-scripts-after-connecting/


More information about the systemd-devel mailing list