epmd port alternative specifications

Michael Truog mjtruog@REDACTED
Sat Sep 19 06:46:21 CEST 2009


Others may be aware of this.  However, it does seem inconsistent and not
very obvious, like a bug or a problem that emerged after separate
development stages.

Specifying a different port for epmd is a complex task, especially if it
is fed to a module like slave.  I am finding myself using a script like
the one attached below.  Basically, the epmd port needs to be specified
in 3 separate ways for things to work properly.  The environmental
variable ERL_EPMD_PORT must be specified before erl is called to be
effective.  If ERL_EPMD_PORT needs to be retrieved from os:getenv/1 it
needs to be in a separate -env argument to erl (not sure why). 
net_kernel:start/1 depends on a different argument method because it
uses the -epmd_port erl argument.  Perhaps this is by design, but it
would be more straightforward if net_kernel took the environmental
variable instead of the different command line argument (however, this
could be due to the second problem).

script:
#!/bin/bash
ERL_EPMD_PORT=$1
# os:getenv/1 requires the -env parameter
# net_kernel:start/1 requires the -epmd_port
exec ${*:2} -env ERL_EPMD_PORT $ERL_EPMD_PORT -epmd_port $ERL_EPMD_PORT

Sorry if this has already been reported.

Thanks,
Michael


More information about the erlang-bugs mailing list