[systemd-devel] network consuming user services

Sebastian Tramp mail at sebastian.tramp.name
Fri May 4 01:23:25 PDT 2012


On Thu, May 03, 2012 at 12:29:04AM +0200, Lennart Poettering wrote:
> On Wed, 02.05.12 22:19, Sebastian Tramp (mail at sebastian.tramp.name) wrote:
> 
> > Hi,
> > 
> > I want to start some user services which need a working network connection.
> > This includes services as
> > 
> > * "fetchmail --idle" to receive mails
> > * ssh tunnel with autossh
> > * dyndns update
> > 
> > I recently switched to systemd 44 on arch linux but after one day of try and
> > error as well as manpage reading I am not sure that this is in the scope of
> > systemd.
> > 
> > The best solution could be to hear on dbus, if the NetworkManager sends an
> > "online event". The services need to be finished if the network is down and
> > started again if we are online again.
> > 
> > Are there existing service files which solve a similar or the same
> > issue?
> 
> Ideally services like yours would just listen to netlink events so that
> they can properly handle connectivity coming and going. In today's
> dynamic world having daemons that fail if the network isn't up is
> backwards, in particular since the definition of "network is up" is
> hard on machines with multiple network interfaces, or machines connected
> indirectly to the internet. i.e. link beat or pingability might matter
> more.
> 
> In summary: we think the only correct way to handle network connectivity
> is to make the daemons watch netlink. To provide compatibility with
> services that currently not do it we provide the generic
> "network.target" which can be used as synchronization point for all
> services that only care for "network is up", for whatever definition
> this might be. Depending on the specific installation this can then be
> filled with different definitions. One option for example is to enable
> the "NetworkManager-wait-online.service", which hooks into NM and waits
> until a network configuration is applied and is subject to a
> timeout. Just run "systemctl enable NetworkManager-wait-online.service"
> and it will order itself before network.target, thus exposing the
> desired behaviour.

Thank you for this answer. Unfortunately, this blocks my boot procedure in the
case of no network.

Is there a way to describe the units in a way that they are started after
network managers ok signal?

My use case is strongly laptop driven:
- most of the time I'm working in a docking station with cable network available
- Sometimes I'm in a wlan area
  (but to connect I need to unlock my keystore so it is not on boot time) and
- sometimes I'm totally offline.

In all cases I wish that my user demons wait until network manager says ok.

Currently I start my demons manually but hoped that systemd can help me with
that. Before systemd, I re-run them every 10min with cron (so they failed on no
network). In the worst case I could do the same with timer units but this is
definitely not the systemd way :-)

Best regards

Sebastian Tramp

-- 
WebID: http://sebastian.tramp.name
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 478 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20120504/cb20e4f1/attachment.pgp>


More information about the systemd-devel mailing list