Can't start process when starting erlang node.

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Can't start process when starting erlang node.

yuzhu chen
I was trying to start a supervisor and a gen_server process while one node is created from the command-line, I use the following command to start the node:

erl -name vm01@ -s ets_sup start vm02@ calc

However, I found the process is undefined when I use whereis to check the process on the newly created node. I got no problems running ets_sup and ets_srv on the node shell directly, but starting the node from command line doesn't work. I want to know why this happening?


-export([start/1, start_link/1, init/1]).

start([A, B]) ->
        start_link([A, B]).

start_link([A, B]) ->
        supervisor:start_link({local, ?MODULE}, ?MODULE, [A, B]).

init([A, B]) ->
        {ok, {{one_for_all, 0, 1},
                [{ets_srv, {ets_srv, start_link, [A, B]}, permanent, 5000, worker, [ets_srv]}]}}.



-record(state, {a, b}).

start_link(A,B) ->
        gen_server:start_link({local, ?MODULE}, ?MODULE, [A, B], []).

init([A, B]) ->
        {ok, #state{a = A, b = B}}.

check_sys() ->
        gen_server:call(?MODULE, check_sys).

handle_call(check_sys, _From, #state{a = A, b = B} = State) ->
        {reply, {A, B}, State}.

handle_info(_Info, State) -> {noreply, State}.

handle_cast(_Req, State) -> {noreply, State}.

code_change(_Ol, State, _Ex) -> {ok, State}.

terminate(_R, _S) -> ok.

erlang-questions mailing list
[hidden email]