<div dir="ltr"><div><div><div><div>Hi Magnus,<br><br></div>Tried application:stop, giving me error:<br><br> application:stop(uclient).<br>{error,{not_started,uclient}}<br><br></div>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.<br><br></div>Regards,<br></div>Harsha.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 30, 2015 at 4:19 PM, Magnus Henoch <span dir="ltr"><<a href="mailto:magnus@erlang-solutions.com" target="_blank">magnus@erlang-solutions.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">harsha sri <<a href="mailto:harsha.pic@gmail.com" target="_blank">harsha.pic@gmail.com</a>> writes:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am running appication with Supervisor & Worker model.  Can anybody guide me through how to stop application or restart my application.<br>
<br>
Below is my application file:<br>
<br>
-module(uclient).<br>
<br>
-behaviour(application).<br>
<br>
-export([start/2, stop/1]).<br>
<br>
-record(state, {pid}).<br>
<br>
start(normal, []) -><br>
   case uclient_sup:start_link({<u></u>uclient_sup}) of<br>
      {ok, Pid} -> {ok, Pid};<br>
      Error -> Error<br>
   end.<br>
   %%uclient_sup:start_link({<u></u>uclient_sup}).<br>
<br>
stop(_State) -><br>
    ok.<br>
<br>
 Tried to stop application from erl command line, but getting error as below:<br>
<br>
uclient:stop().<br>
** exception error: undefined function uclient:stop/0<br>
</blockquote>
<br></div></div>
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.<br>
<br>
The real work of stopping an application is stopping the supervision tree and all the linked processes.  For that, you need application:stop/1:<br>
<br>
application:stop(uclient).<br>
<br>
Regards,<br>
Magnus<br>
</blockquote></div><br></div>