[erlang-questions] gen_server:cast from escript

Park, Sungjin <>
Thu Mar 10 04:35:21 CET 2016


You didn't connect to target node.
Have to call net_adm:ping(Node) first to connect.



On Tue, Mar 8, 2016 at 3:47 PM, YuanZhiqian <>
wrote:

> Hi guys,
>
>   I was trying to call gen_server:cast from a escript file, everything
> that used to work well in erl shell won't work in escript, I have no idea
> what made the difference, here is the code, could anyone help me to find a
> clue?
>
>
>
> #!/usr/bin/env escript
>
> %%! -name  -setcookie budget_keeper
>
> main(Argv) ->
>     {Node, File} = case Argv of
>                        [] ->
>                            *{'
> <>', "cache"*};
>                        [F] ->
>                            {'', F};
>                        [N, F] ->
>                            {N, F}
>                    end,
>     io:format("~p ~p ~p ~p~n", [node(), erlang:get_cookie(), Node, File]),
>     gen_server:cast({bk_main, Node}, {dump_data, File}).
>
>
>
> As shown above, the target process is called "bk_main" which is on the
> node '', I have run the same code in erl shell,
> and bk_main can get the notice, but nothing happened when I ran the same
> code in this script.
>
> Best regards
> Zhiqian
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>


-- 
Park, Sungjin
-------------------------------------------------------------------------------------------------------------------
Peculiar travel suggestions are dancing lessons from god.
  -- The Books of Bokonon
-------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160310/26884406/attachment.html>


More information about the erlang-questions mailing list