Hi all!

Since (from my understanding) systemd devel team did not want to interpret nor 
force its interpretation of "network availability" on systemd consumers, we 
have to use some other services and cross fingers (network.target, systemd-
networkd-wait-online.service and so on).

However, everything I tried proved an utter failure: target says reached even 
though it doesn't even have an IP on any link; wait-online obviously didn't 
even check if I had a DNS whatsoever.

In the end, I had to write my own (ugly) service to test if a domain is 
reachable:

/etc/systemd/system/[email protected] 
[Unit]
Description=Test if %i is reachable
# I'm not even sure it's useful, because it doesn't do its job
After=systemd-networkd-wait-online.service
 
[Service]
Type=forking
ExecStart=/usr/bin/ping -c1 %i
Restart=on-failure
# Needed, else the unit just goes crazy
# if there are no links and systemd stops it
RestartSec=2

# I don't know if the [Install] part is needed
[Install]
WantedBy=multi-user.target

This works but using the Type=forking is an ugly hack: the result I'm waiting 
for would be:
o Call reachable-retry@ in a unit (Requires and After);
o If it fails, try again (seems OK with the Restart directive);
o If it succeeds, the unit that needs to reach %i gets launched and my 
reachable-retry@ *does not* enter SUCCESS or whatever "good" state you can 
think of: it just stays asleep until someone else wants to recheck later if 
the domain is still reachable (e.g. domain goes down, my ISP goes crazy, I 
suspend my computer...).

An other unit I could use would be reachable@ that would simply test whether 
or not a domain is reachable and:
o In case it isn't, prevent a unit from being launched, period.
o In case it is, launch the unit and don't enter any SUCCESS or "good" state.
o If an other unit needs to test afterwards, launch the test again.
Would Type=oneshot do that?

Any input would be greatly appreciated.
The issue was also a bit discussed here:
 https://bbs.archlinux.org/viewtopic.php?id=182717
And here too (in French):
 https://forums.archlinux.fr/topic15485.html

Cheers,
--
Moviuro

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to