Am 2017-09-23 um 13:08 schrieb Ritesh Raj Sarraf:
> Hello Jakobus,
> 
> On Thu, 2017-09-07 at 21:06 +0200, Jakobus Schürz wrote:
>>>
>>> I am currently testing with the changes you've mentioned (And would
>>> like to move to a socket based setup).
>>
>> For sure :-)
>>
>> Here are all my units for leafnode:
>>
> 
> Thank you very much. With your setup in place, I have been able to
> successfully run leafnode with systemd integration. I tested it for
> around a week now and everything is working perfect.
> 
> If I could add a wishlist, it is dependency of the fetchnews service
> unit/timer to runtime depend on network-online.target.
> 
> As I understand it now, fetchnews will be triggered only if the
> network-online.target is active. So it does solve the service startup
> at boot time, ensuring that fetchnews does not get triggered until and
> unless a working operational network setup is in place.
> 
> But like yours', my leafnode setup is on my laptop. Which goes through
> multiple suspend/resume and network cycles. There are also times, when
> upon resume there is no network (networkless location, airplane mode
> etc). Under such scenarios, systemd should only invoke such timers if
> an active network connection is available.
> 
> Do you happen to know if we could configure the units/timers in such a
> way that it probes the network-online.target for actual network
> connectivity, and only then invoke the timers ?

This is a good point. I also asked on the systemd list for this (not
only leafnode should be only started, only when a network-connection is
available... fetchmail is the same).

They said me, systemd starts services and can restart a service, if it
stops working in case of a failure. But systemd is not designed to watch
available network-connections...

So network-online.target ist started, when for example
network-manager.service ist started successfully... not when the
connection is up and running.

Network-Manager has to start and stop a special target, when
connection-state is changing. But that is not as easy as I thougt... How
to check, if a connection is up? How to check, if a connection is
working? Ping some servers? Ping a special server? What is, if a server
is configured, not to answer ICMP?

I'm also working on a solution to use an own target, which i call
"connection-online.target" and "[email protected]" to
instantiate this target for every network-device.

The instantiated targets ([email protected],
[email protected] or for tun0...) have the option, to start
a service only if a certain device is online. Bind a service to
"connection-online.target", it will start if any connection is online.

The dependecy for fetchnews.timer can be "connection-online.target".
Connection-online.target gets started from a network-manager-dispatcher
script, and also gets stopped on such a script.
The dependencies for fetchnews.timer are
"PartOf=connection-online.target
After=connection-online.target"

So every time, connection-online.target is started, fetchnews.timer is
also startet. The same for stopping connection-online.target.

You need a dispatcher-script which checks the online-state with
"nm-online", and depending on the result, connection-online.target is
started or stopped...

But what, if some doesn't use NetworkManager? If someone is using wicd
or systemd-networkd?
Ok, for the last, there could be a native solution... but I do not use
systemd-networkd, because it is not practicable on Laptops...
For wicd, there is also a possibility for starting scripts on
statechanges... so connection-online should also be working.

But I haven't finnished this solution.

For now, the dependecy to network-online.target should be enough.

Best regards

Jakob

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to