[erlang-questions] Stopping Application in erlang.

harsha sri harsha.pic@REDACTED
Mon Mar 30 13:11:44 CEST 2015


Hi Magnus,

Tried application:stop, giving me error:

 application:stop(uclient).
{error,{not_started,uclient}}

Actually application got started and its running also. This application i
am running ad rabbitmq plugin and its running also, only thing i need to
stop my application and restart application which i am not able to do.

Regards,
Harsha.

On Mon, Mar 30, 2015 at 4:19 PM, Magnus Henoch <magnus@REDACTED>
wrote:

> harsha sri <harsha.pic@REDACTED> writes:
>
>  I am running appication with Supervisor & Worker model.  Can anybody
>> guide me through how to stop application or restart my application.
>>
>> Below is my application file:
>>
>> -module(uclient).
>>
>> -behaviour(application).
>>
>> -export([start/2, stop/1]).
>>
>> -record(state, {pid}).
>>
>> start(normal, []) ->
>>    case uclient_sup:start_link({uclient_sup}) of
>>       {ok, Pid} -> {ok, Pid};
>>       Error -> Error
>>    end.
>>    %%uclient_sup:start_link({uclient_sup}).
>>
>> stop(_State) ->
>>     ok.
>>
>>  Tried to stop application from erl command line, but getting error as
>> below:
>>
>> uclient:stop().
>> ** exception error: undefined function uclient:stop/0
>>
>
> The function uclient:stop/1 in your application module is just a callback
> module, that is supposed to do any application-specific cleanup before the
> application is stopped.  In most cases, it will look just like yours in the
> example above: it does nothing.
>
> The real work of stopping an application is stopping the supervision tree
> and all the linked processes.  For that, you need application:stop/1:
>
> application:stop(uclient).
>
> Regards,
> Magnus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150330/8feae8b0/attachment.htm>


More information about the erlang-questions mailing list