application startup

Gunilla Arendt gunilla@REDACTED
Mon Aug 15 09:00:21 CEST 2005


It is possible to specify that an application should only be loaded, not 
started, when creating the .rel file (see also rel(3)):

{release, {"drpdb","1.0"}, {erts, "5.4.8"},
   [{kernel,"2.10.9"},
    {stdlib,"1.13.8"},
    {sasl, "2.0.1"},
    {drpdb, "1.0"},
    {os_mon, "1.7.4", load},
    {mnesia, "4.2.2", load}
   ]}.

(At least when using systools:make_script/1,2 to generate the boot 
script, I don't know about 'builder').

IMO, this is a much better way to do it. Unless, of course, you really 
want os_mon and mnesia to be included applications, started by a 
supervisor in drpdb.

/ Gunilla



Serge Aleynikov wrote:
> Ulf,
> 
> I seemed to have rushed to ask the question before searching the mailing 
> list.  'included_applications' attribute does the trick.
> 
> So if I understand this correctly, in this case only sasl and drpdb will 
> be started automatically (besides kernel and stdlib), and not mnesia and 
> os_mon:
> 
> {release, {"drpdb","1.0"}, {erts, "5.4.8"},
>   [{kernel,"2.10.9"},
>    {stdlib,"1.13.8"},
>    {sasl, "2.0.1"},
>    {drpdb, "1.0"},
>    {os_mon, "1.7.4"},
>    {mnesia, "4.2.2"}
>   ]}.
> 
> {application, drpdb,
>   [
>    ...
>    {included_applications, [ mnesia, os_mon ] },
>    {applications, [ kernel, sasl ] },
>    {mod, {drpdb_app, []}},
>    {env, []}
>    ]
> }.
> 
> Also I found your post where you modified the application_controller to 
> customize start_phases:
> 
> http://forums.trapexit.org:81/phpBB/viewtopic.php?t=4574&highlight=build+applications+start 
> 
> 
> Is that available for download?
> 
> Thanks.
> 
> Serge
> 
> Serge Aleynikov wrote:
> 
>> Ulf Wiger wrote:
>>
>>>
>>> All applications in the .rel file are started
>>> automatically if they
>>> - have a 'mod' attribute
>>
>>
>>
>> I looked at $ERL_ROOT/lib/* and sampled several standard apps - they 
>> all have a 'mod' attribute, so I infer that by default any app listed 
>> in the application's *.rel file will get started automatically by 
>> default.
>>
>>> - are not included in another application
>>
>>
>>
>> I.e. not being included in the application's 'applications' attributes 
>> in the *.app file, or there's another place to include an
>> application?
>>
>>> The 'builder' contrib builds two start scripts:
>>> one where all applications are started as expected,
>>> and one where only kernel and stdlib are started,
>>> but all applications are loaded, and the code path
>>> set to include all code. The latter script is useful
>>> if you e.g. want to initialize mnesia and other stuff,
>>> and the way it's generated is by simply modifying the
>>> start script after it's been built.
>>
>>
>>
>> Thanks, I downloaded the 'builder' contrib.  Will experiment with it.
>>
>> Serge
>>
>>> Den 2005-08-12 23:21:30 skrev Serge Aleynikov <serge@REDACTED>:
>>>
> Folks,
> 
>>>>
>>>> I have the following config, and I noticed that os_mon and mnesia  
>>>> applications get started at startup when I use a boot script:
>>>>
>>>>  >erlc -pa ../ebin -o ../ebin drpdb.rel
>>>>  >cd ../ebin
>>>>  >erl -boot drpdb -sname drpdb -config ../priv/drpdb
>>>>
>>>> I was under impression that if an application is listed in the 
>>>> *.rel  file, it should be loaded but not started.  In order for it 
>>>> to be  started it must be included in the {applications, ...} tuple 
>>>> of the  *.app file.  However, what I am observing is that all apps 
>>>> that are  listed in the *.rel file are started automatically.  Am I 
>>>> doing  something wrong?
>>>>
>>>> ====== drpdb.rel ========
>>>> {release, {"drpdb","1.0"}, {erts, "5.4.8"},
>>>>   [{kernel,"2.10.9"},
>>>>    {stdlib,"1.13.8"},
>>>>    {sasl, "2.0.1"},
>>>>    {drpdb, "1.0"},
>>>>    {os_mon, "1.7.4"},
>>>>    {mnesia, "4.2.2"}
>>>>   ]}.
>>>>
>>>>
>>>> ====== drpdb.app ========
>>>> {application, drpdb,
>>>>   [
>>>>    {description, "Master Database Server"},
>>>>    {vsn, "1.0"},
>>>>    {id, "drpdb"},
>>>>    {modules,
>>>>     [
>>>>        drpdb_app,
>>>>        drpdb_sup,
>>>>        drpdb
>>>>      ]
>>>>     },
>>>>     {registered, [ drpdb_sup, drpdb ] },
>>>>     {applications, [ kernel, sasl ] },
>>>>     {mod, {drpdb_app, []}},
>>>>     {env, []}
>>>>    ]
>>>> }.
>>>>
>>>
>>>
>>>
>>
> 


-- 
_____Gunilla Arendt______________________________________________
OTP Development
Gunilla.Arendt@REDACTED  +46-8-7275730  ecn 851 5730



More information about the erlang-questions mailing list