[systemd-devel] Waiting for (transient) hostname configuration

Alessio Igor Bogani alessio.bogani at elettra.eu
Tue Apr 19 09:14:22 UTC 2022


Dear systemd developers,

Sorry for my very bad english.

We use the hostname provided by DHCP to start the right subset of our
applications on each of our machines (in other words the transient
hostname is used as predictable machine identifier).

Make it works on the ancient SysV is straightforward but I can't find
a (reasonable) way to achieve the same goal with systemd. We already
use both "Requires" and "After" with "network-online.target
nss-lookup.target" into our units but it isn't enough. When our units
start they obtain "localhost" from %H specifier. We don't find a way
to wait for (transient) hostname to be configured. The only solution
that it seems to work is to replace our binary in ExecStart with a
script which make a busy-loop until `hostname` output doesn't differ
from "localhost".

Is there a better way?

Thank you very much!

Ciao,
Alessio


More information about the systemd-devel mailing list