[erlang-questions] erl startup issue

Wes James comptekki@REDACTED
Thu Nov 3 20:13:18 CET 2011


When I do this:

erl -name node@REDACTED -pa /usr/local/src/misultin/ebin -run my_mod start
8080 -run my_second_mod

my_second_mod starts fine but the misultin part won't auto-start.
After erl has started I have to run it manually:  my_mod:start(8080).

This is the top of the test misultin code:


-module(my_mod).
-export([start/1, stop/0]).

% start misultin http server
start(Port) when is_integer(Port) ->
    io:format("~n is integer ~n"),
    start1(Port);
start([Port]) ->
    io:format("~n is list: ~p ~n",[Port]),
    PortInt=list_to_integer(Port),
    start1(PortInt).

start1(Port) ->
io:format("~n in start1 ~n"),
    misultin:start_link([{port, Port}, {loop, fun(Req) ->
handle_http(Req, Port) end}, {ws_loop, fun(Ws) -> handle_websocket(Ws)
end}]).


....

I can tell that it is reaching start1() from either the -run or from
inside erl, but the misultin:start_link doesn't seem to work from
-run.  Any ideas why?

The reason I have two start() funs, is if started via erl -run the
8080 comes in as ["8080"], whereas in erl VM , it is just an integer
with my_mod:start(8080).

Thanks,

-wes



More information about the erlang-questions mailing list