why misultin not working in detached mode?
subhasri opened this issue · comments
Hi,
Thanks for your reply..
done as you told.. but still getting same problem.
when i run myapplication in erl shell as follows
erl
application:start(my_app).
ok
myapp_server:start_misultin(7100,5).
ok
then misultin listening http_requests on ports 7100 to 7104.
but i need to run my application in detached mode(daemon)..
To perform this i wrote one program(here my_program) which open one erlang shell in detached mode
and run my application in that node. I didnt get any error..
but misultin not listening on particular ports to handle requests.
what went wrong?
what may be the problem in handing http_request when i am running my application in detached mode?
my_program is
my_program()->
[|[HostName|]] = string:tokens(atom_to_list(node()),"@"),
Name = "adserver_" ++ integer_to_list(StartPort),
NodeName = list_to_atom(Name ++ "@" ++ HostName),
os:cmd("erl -noshell -env ERL_FULLSWEEP_AFTER 7 -sname " ++ Name ++ " -setcookie abc -detached"),
case catch(rpc:call(NodeName,application, start,[myapp_otp])) of
{'EXIT',} ->
io:format("Exit error ~n"),
"";
{badrpc,} ->
io:format("badrpc error ~n"),
"";
{error,Error}->
io:format("error ~p~n",[Error]),
"";
ok->
case catch( rpc:call(NodeName, myapp_server, start_misultin,[StartPort,NoOfPorts]))of
ok ->
io:format("myapp_server:misultin successfully started on node ~p~n",[NodeName]);
E ->
io:format("myapp_server:misultin not started on node with error ~p~n",[E])
end.
and my start_misultin process performs following
--------------
start_misultin()->
Ports=lists:seq(Sp,Sp+Nop-1),
lists:foreach(fun(Port)-> misultin:start_link([{port, Port}, {name, list_to_atom("misultin_"++integer_to_list(Port))}, {loop, fun(Req) -> handle_http(Req) end}]) end ,Ports).
Note: misultin is in my erlang library..my application file .app also includes all related misultin files..
this is out of scope for this issue list, you may consider writing to erlang-questions so we can take it from there.