|
|
| Author |
Message |
|
| nicks |
Posted: Sun Mar 06, 2011 5:31 pm |
|
|
|
Joined: 25 Dec 2009
Posts: 9
|
I am facing problems starting my db.erl module using supervisor tree (system_tests:execute() on shell). Supervisor immediately goes to "shutdown"
However, my db.erl starts up perfectly stand alone.
Code: -module(system_tests).
execute() ->
S = .......
{ok, _} = my_sup:start_link([S]).
Code: -module(my_sup).
-behaviour(supervisor).
-export([start_link/1,stop/1,init/1]).
start_link([S]) ->
supervisor:start_link({local, my_sup}, ?MODULE, [S]).
init([S]) ->
Db = {db,{db,start_link,[S]} ,permanent,5000,worker,[db]},
{ok,{{one_for_one, 3, 10}, [Db]}}.
Code:
-module(db).
-behaviour(gen_server).
start_link([S]) ->
gen_server:start_link({local, db},?MODULE, [S], []).
init([S])->
{ok, S}.
.........
I am unable to figure out ...! Some help appreciated. |
|
|
| Back to top |
|
| zajda |
Posted: Thu Mar 10, 2011 10:30 pm |
|
|
|
User
Joined: 22 Aug 2009
Posts: 83
|
Remove brackets from start_link clauses.
e.g. here: {db,start_link,[S]} <=> db:start_link(S) not db:start_link([S])
It is a bit different between start_link and init. You should analyze some fresh, working example (or some open source project on github). |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|