[erlang-questions] Erlang deamon question

Scott Lystig Fritchie fritchie@REDACTED
Tue Mar 9 23:18:35 CET 2010


Nicholas Frechette <zeno490@REDACTED> wrote:

nf> Is there no way to use rpc:call and the likes from an offline node?

Yes, I suppose so, but then it wouldn't be offline, either.  An escript
is welcome to call net_adm:ping/1 (the lazy way, and assumes that you
have "-name foo" or "-sname foo" embedded in the "%%!" line at the top
of the escript) or call net_kernel:start/1 and net_kernel:connect_node/1
and then use rpc:call(), !, or whatever you want to communicate with
whatever you want.

In some shell scripts, we use "erl -sname tmp$$ -remsh foo@REDACTED ..."
to do our bidding.  If you were really, ultra-super worried about
exhausing the atom table after creating 'tmp72' and 'tmp66523', then you
can use net_kernel:start/1 in an iterative loop to try 'tmp0', 'tmp1',
and so on until you managed to get an {ok, Pid} return value.  Or use
the undocumented (?) kernel module 'erl_epmd' to help find an unused
name, though you'd still have to be prepared to try again in the case of
2 VMs racing to register the same name.

-Scott


More information about the erlang-questions mailing list