[erlang-questions] gen_server:cast from escript

Park, Sungjin jinni.park@REDACTED
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 <on-your-mark@REDACTED>
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 bk@REDACTED -setcookie budget_keeper
>
> main(Argv) ->
>     {Node, File} = case Argv of
>                        [] ->
>                            *{'budget_keeper@REDACTED
> <budget_keeper@REDACTED>', "cache"*};
>                        [F] ->
>                            {'budget_keeper@REDACTED', 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 'budget_keeper@REDACTED', 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
> erlang-questions@REDACTED
> 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.htm>


More information about the erlang-questions mailing list