[erlang-questions] gen_server:cast from escript
YuanZhiqian
on-your-mark@REDACTED
Mon Mar 21 07:00:35 CET 2016
Hi Park,
Thanks a lot. That works! I wonder, however, why it is needed to connect to target node manually in an escript, while in a shell I can directly execute gen_server:cast to another target node.
RegardsZhiqian
Date: Thu, 10 Mar 2016 12:35:21 +0900
Subject: Re: [erlang-questions] gen_server:cast from escript
From: jinni.park@REDACTED
To: on-your-mark@REDACTED
CC: erlang-questions@REDACTED
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', "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 regardsZhiqian
_______________________________________________
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/20160321/a97ec1b6/attachment.htm>
More information about the erlang-questions
mailing list