> Gesendet: Montag, 12. September 2022 um 21:06 Uhr > Von: "Darac Marjal" <mailingl...@darac.org.uk> > An: debian-user@lists.debian.org > Betreff: Re: systemd automount unit: run only when server is reachable > > systemd has a number of Condition* rules which can be added to units: > https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Conditions%20and%20Asserts > > You could maybe rig something up with that.
Already looked at these. Unfortunately they all check fixed conditions. You cannot run an arbitrary shell script. Only thing that would work is to run a script in the background that creates a certain file, if the server is available. Then I could use ConditionPathExists=. But thats again an ugly solution. I found ExecCondition= in the docs. This option would do exactly what I want. But its allowed only in the [Service] section which both mount and automount units dont have. > > Alternatively, if the mount always takes at least 10 seconds, then that > sounds like it might be a DNS issue. I see that you're trying to mount > the host as "lana". If you're connecting over a VPN, it's likely that > you're not using the same DNS resolver as at home, so perhaps something > is timing out before it finally resolves. Do you get the same 10 second > delay if you mount the path at the command line? If you add "-v" to the > mount command, you might see the NFS client trying various options. DNS is not the issue. lana has a fixed IP and that ist written in the hosts file. It takes so long beacuse of the internet connection. Depending on how far away you are from your home server, I guess it would take even longer. I think its mainly based on the latency of the line. Just did a test with manual mounting and it took 3.5 s. But when I tried some days ago it was much higher. Jürgen