[erlang-questions] erl startup issue

Magnus Klaar <>
Thu Nov 3 20:24:40 CET 2011


Hi!

The functions specified with -s are not evaluated by the shell process. See
this response to a similar question for a better explanation of what
actually happens when you start misultins supervisor this way.

http://erlang.org/pipermail/erlang-questions/2009-February/041805.html

MVH Magnus

On Thu, Nov 3, 2011 at 8:13 PM, Wes James <> wrote:

> When I do this:
>
> erl -name  -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
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111103/bd40f65e/attachment.html>


More information about the erlang-questions mailing list