I am trying to start an application form the command line. The application is basically a OTP compliant TCP server and it works fine when started from the shell. However, when started form the command line it actually does not start.
I have all files in a compliant folder structure, meaning sources in \src and binaries \ebin. I have set the path in the .erlang file with
code:add_patha("./ebin").
And the function that is being called is in this module
-module(wotsuke_geolocation_lookup_server).
-behaviour(application).
-export([start/0, start/2, stop/1]).
start() ->
event_dbs:start(),
wotsuke_server_sup:start_link().
start(_Type, _Args) ->
event_dbs:start(),
wotsuke_server_sup:start_link().
stop(_State) ->
ok.
I have added (redundantly) also a start/0 (i use a start/2 due to future features requiring the args) because starting with arguments never worked. Now when I run:
erl -run wotsuke_geolocation_lookup_server start [] []
I get
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
{"init terminating in do_boot",{undef,[{wotsuke_geolocation_lookup_server,start,[["[]","[]"]],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump is being written to: erl_crash.dump...done
init terminating in do_boot ()
Meaning it cannot find the module/function. Therefore, I used the redundant start/0
erl -run wotsuke_geolocation_lookup_server start
and get:
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.0 (abort with ^G)
1>
Basically nothing is started (no process ID returned). I tried to connect to the server and get the typical answer when the server is off. I also tried by forcing erl to the ebin folder with the -pa option. Same as above.
As a this is the first time I am trying to run an erlang app from the command line (in order to demonize it), I am left clueless.
Thanks for any help.
ADDED: not sure it helps, I add the erlang app code as well
{application, wotsuke_geolocation_lookup_server,
[{description, "Wotsuke Geolocation lookup server"},
{vsn, "0.1.0"},
{modules, [tcpserver_otp_backend, ets_methods, data_packing, data_formats, event_timings, logger, event_dbs,
obsolete_data_clean_ad, obsolete_data_clean, wotsuke_data_input, wotsuke_logger, wotsuke_server_sup, data_retrieve, wotsuke_data_output, user_event_dbs,
event_areas]},
{registered, [wotsuke_data_input, wotsuke_server_sup, wotsuke_logger, wotsuke_data_output]},
{applications, [kernel, stdlib, mnesia]},
{env, []},
{mod, {bsc, []}}]}.
UPDATE: One issue is solved. The issue with the command
erl -run wotsuke_geolocation_lookup_server start [] []
is actually due t the fact that erl expects either a start/0 is only the module is specified or arity 1 if the function is also specified. Making [] [] to be seen as [[],[]].
erl -run wotsuke_geolocation_lookup_server start [] []
up as one argument as{"init terminating in do_boot",{undef,[{wotsuke_geolocation_lookup_server,start,[["[]","[]"]],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
means undef for start/1 as["[]","[]"]
is one argument – ernstroux