[erlang-questions] Stopping Application in erlang.

Daniel Hallin Widgren <>
Mon Mar 30 14:12:18 CEST 2015


Can it be so that your application is named something else?

How is your .app file?

Can you see your application if you run application:which_applications()?
Den 30 mar 2015 13:12 skrev "harsha sri" <>:

> 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 <
> > wrote:
>
>> harsha sri <> 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
>>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150330/426da8e2/attachment.html>


More information about the erlang-questions mailing list