[systemd-devel] network consuming user services

Sebastian Tramp mail at sebastian.tramp.name
Fri May 4 02:14:49 PDT 2012


On Fri, May 04, 2012 at 10:23:25AM +0200, Sebastian Tramp wrote:
> 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?

ok, did not read davids response before that. a better way is to let start the
target from network manager site. this works fine for me.

Best regards

Sebastian Tramp

> 
> 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/ffa9d1eb/attachment.pgp>


More information about the systemd-devel mailing list