[erlang-questions] Stopping Application in erlang.

Daniel Hallin Widgren <>
Mon Mar 30 18:43:04 CEST 2015


Have you tried:

Application:start(uclient).
Application:stop(uclient).
Den 30 mar 2015 17:11 skrev "harsha sri" <>:

> Hi Daniel,
>
> This is my uclient.app.src:
>
> {application, uclient,
>  [{description, "UC Client Plugin for Provisioning ontot callmanager"},
>   {vsn, "%%VSN%%"},
>   {modules, []},
>   {id, "uclient"},
>   {registered, [uclient]},
>   {mod, {uclient, []}},
>   {env, []},
>   {applications, [kernel, stdlib, rabbit, amqp_client]}]}.
>
> Regards,
> Harsha
>
> On Mon, Mar 30, 2015 at 5:42 PM, Daniel Hallin Widgren <
> > wrote:
>
>> 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/3ad086dc/attachment.html>


More information about the erlang-questions mailing list