Terminating application during startup

Gunilla Arendt gunilla@REDACTED
Wed Mar 22 14:22:44 CET 2006


Then let your application recognize that it cannot start,
print out an error message and call erlang:halt(N) with an appropriate
error code N.

--------------
-module(my).

-export([start/2]).

start(normal, [foo]) ->
     io:format("Cannot start due to whatever~n", []),
     erlang:halt(1).
---------------

% erl -boot my -noshell
Cannot start due to whatever
%


Regards, Gunilla

Fredrik Thulin wrote:
> On Wednesday 22 March 2006 10:42, Gunilla Arendt wrote:
>> Hi,
>>
>> This bug is fixed in OTP R11B.
> 
> Thanks.
> 
>> I'm not quite sure what you mean with "terminating nicely". If you
>> mean that you want the node to survive even if an application fails
>> to start, set the type of the application to transient in the .rel
>> file.
> 
> I'm using Erlang to write a SIP-server that I want to make work like 
> most other server softwares people are used to, so that it can be used 
> without any knowledge about Erlang, beam, Mnesia and so on, just 
> regular system administration skills.
> 
> In my opinion, this means that if certain fatal errors occur during 
> startup, the Erlang VM (whole node) should terminate with 
> 
>    * a nice and understandable error message on standard output
> 
> and
> 
>    * a non-zero exit status so that people can start the server from a 
>      shellscript and know if it failed or succeeded.
> 
> Also, the generation of erl_crash.dump should be avoided when I (as 
> programmer) don't think it is needed (for example, the server could be 
> started in a just-test-the-config-syntax mode).
> 
> /Fredrik
> 
> 




More information about the erlang-questions mailing list