[erlang-questions] escript and epmd
Stefan Strigler
steve@REDACTED
Wed Sep 19 18:42:48 CEST 2007
Hi, next question :)
How can I make sure that epmd is running when using escript. I want to
start a named node from within escript and ping some other node like
this:
#!/usr/bin/env escript
main(_) ->
net_kernel:start([foo, shortnames]),
erlang:set_cookie(some_random_cookie),
case net_adm:ping(some_other_node) of
pong -> ...
pang -> %% spawn some_other_node
...
end.
But if epmd isn't running already I get:
=INFO REPORT==== 19-Sep-2007::18:50:36 ===
Protocol: "inet_tcp": register error: {{badmatch,{error,econnrefused}},
[{inet_tcp_dist,listen,1},
{net_kernel,start_protos,4},
{net_kernel,start_protos,3},
{net_kernel,init_node,2},
{net_kernel,init,1},
{gen_server,init_it,6},
{proc_lib,init_p,5}]}
escript: script failed with error reason function_clause
Any help appreciated, Steve
More information about the erlang-questions
mailing list