[erlang-questions] reliably figure out hostname

Tim Watson <>
Fri Aug 3 00:56:06 CEST 2012

On 2 August 2012 22:58, Geoff Cant <> wrote:
> From (hazy) memory, longnames are configured using
> net_adm:localhost(). This differs from the local host name resolution
> methods given in the thread in that it uses the contents of
> 'resolv.conf' (specifically the domain option) to construct the FQDN
> from the hostname.

Now that looks a bit more promising... But what of systems where
resolv.conf isn't used?

> The last time I tried to write a reliable distribution based
> start/stop/status control script, I'm pretty sure I ended up inspecting
> the machine configuration, then manually starting distribution via
> something like:
> https://github.com/archaelus/egc_examples/blob/master/rescriptmsh#L6

Ok that's interesting, I'll play around with it and see how things
behave across unices. Thanks for the pointer!

> to ensure that I would get the name I wanted. Unfortunately I don't have
> permission yet to release the control script that implements all this.

Not to worry. My framework starts as a dist node only so it can make
hidden connections if required. By and large, it just run scripts like
the one you're describing to do the actual work of interfacing with
the various nodes in a system under test, but I wanted rpc support
where it made sense (as it did for the initial use case).

Thanks again for pointing out net_adm - will look into that when I get
back from holiday the week after next! :)

More information about the erlang-questions mailing list