[erlang-questions] escript and epmd

Bengt Kleberg <>
Thu Sep 20 07:33:55 CEST 2007


greetings,

coulkd you live with another level of indirection? if you have a shell 
(ex: /bin/sh) script that checks epmd (epmd -names or similar) and then 
start your escript?


bengt
Those were the days...
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."


On 2007-09-19 18:42, Stefan Strigler wrote:
> 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
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list