2011-06-15 5 views
7

나는 st_db.app 파일에 다음과 같이 필요한 응용 프로그램을 가지고있다 :Erlang : 어떻게하면 필요한 모든 응용 프로그램을 자동으로 시작할 수 있습니까?

{application, st_db, 
[ 
    {description, ""}, 
    {vsn, "1.0.0"}, 
    {registered, []}, 
    {modules, [st_db_app, st_db_sup, st_db]}, 
    {applications, [ 
        kernel, 
        stdlib, 
      sasl, 
      crypto, 
      ibrowse, 
      couchbeam 
       ]}, 
    {mod, { st_db_app, []}}, 
    {env, []} 
]}. 

나는 (crypto, sasl 등) 자동으로 실행하고 메인 응용 프로그램을 디버깅 할 필요가있다. 내가 찾은 유일한 해결책은 이러한 매개 변수로 erl을 시작하는 것입니다.

erl -pa ./ebin -pa ./deps/*/ebin -boot start_sasl -s couchbeam -s crypto -s ibrowse 

유일한 방법입니까?

추신 : btw couchbeam 노드에서 시작되지 않습니다. 그냥 couchbeam의 감독자를 시작, 그래서 그것을 수동으로 쉘에서 실행해야합니다

=PROGRESS REPORT==== 15-Jun-2011::10:22:43 === 
      supervisor: {local,couchbeam_sup} 
      started: [{pid,<0.62.0>}, 
         {name,couchbeam}, 
         {mfargs,{couchbeam,start_link,[]}}, 
         {restart_type,permanent}, 
         {shutdown,2000}, 
         {child_type,worker}] 

2> application:start(couchbeam). 
ok 
3> 
=PROGRESS REPORT==== 15-Jun-2011::10:23:25 === 
      supervisor: {local,couchbeam_sup} 
      started: [{pid,<0.69.0>}, 
         {name,couchbeam}, 
         {mfargs,{couchbeam,start_link,[]}}, 
         {restart_type,permanent}, 
         {shutdown,2000}, 
         {child_type,worker}] 

=PROGRESS REPORT==== 15-Jun-2011::10:23:25 === 
     application: couchbeam 
      started_at: [email protected] 

그것을 고치는 방법이 있습니까?

답변

4

-eval "application : start (coucnbeam)"명령을 erl에 실행하거나 적절한 OTP 방법으로 reltool을 사용하여 새 부팅 파일을 생성 할 수 있습니다. 당신은뿐만 아니라 (http://github.com/basho/rebar)

5

당신이 그냥 장난하는 경우 그 조사 할 수 있도록

이 reltool에 대한 정보를 원하시면 http://www.erlang.org/doc/man/reltool.html를 참조하십시오, 또한 철근 당신을 위해 무거운의 대부분을 수행에서 excelent 작업을 수행 콘솔과 이러한 모든 'application : start (...)'을 입력 할 필요가 없습니다. 현재 작업 디렉토리의 .erlang 파일에이 파일을 넣으십시오. 여기에 내가 지금 일하고 있어요 무엇을 예입니다 :

$ cat .erlang 
application:start(crypto). 
application:start(public_key). 
application:start(ssl). 
application:start(ibrowse). 
application:start(foo). 

이 내 모든 종속성을 시작하고 내가 지금 일하고 있어요 응용 프로그램, foo는. 당신은 철근과 reltool 자료를 생성 할 경우


,이 링크는 도움이 될 수 있습니다 : 특히

When to use erlang application:start or included_applications and a supervisor?이 요점 :

https://gist.github.com/3728780

-Todd

0

에서 ensure_all_started API, 단지 쓰기 :

-module(st_db_app). 
-behaviour(application). 
-export([start/2, stop/1]). 

start(_StartType, _StartArg) -> 
    %% Get application name 
    {ok, AppName} = application:get_application(), 
    %% Start all dependencies that are not yet started for application name 
    {ok, _StartedApps} = application:ensure_all_started(AppName), 
    %% start application's root supervisor or do other initialization here 
    %% and return root supervisor's pid. 
관련 문제