Killing a detached application

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Killing a detached application

Dave Bryson-3
I've ran across a problem trying to restart an OTP based application  
that I thought i had stopped in the past.  I started the application  
using the following in a bash script:

  erl -mnesia dir '"$DB_DIR"' \
     -pa $APP_ROOT/ebin $APP_ROOT/deps/ebin \
     -detached \
     -sname messenger \
     -s message_service \
     -boot start_sasl -config $SASL_CONFIG

It started, no problem.

Then later I used erl to remote shell into the application and stop  
it with:

 > message_service:stop().

Checking with regs(). i can see message_service is stopped and  
unregistered.

Now, if I try to run the bash script above again, It won't start and  
I get a crash_dump that's looks like it's caused by a conflicting  
registered name.  Interestingly, I can still remote shell into the  
process with:

erl sname dave -remsh messenger@mango

But the actual OTP application is not running - because i stopped it  
earlier. Once I rebooted my machine all worked as expected.

My question is if you start a shell using "sname" and "-detached" how  
do you properly/completely  stop it?  Is the sname held somewhere  
different then a registered name?

My goal is to be able to control this from an init.d script.

Thanks!
Dave
_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Killing a detached application

Thomas Lindgren

--- Dave Bryson <[hidden email]> wrote:

> My question is if you start a shell using "sname"
> and "-detached" how  
> do you properly/completely  stop it?  Is the sname
> held somewhere  
> different then a registered name?
>
> My goal is to be able to control this from an init.d
> script.

>From what it sounds like, you only stopped your
application running on the node, so you must also stop
the erlang node itself. E.g., while inside that shell:

   init:stop().

Best,
Thomas



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Killing a detached application

Mikl Kurkov-2
In reply to this post by Dave Bryson-3

The problem is that you only stop application while node is stil alive.

Here is Joe tutorial with good example how to deal with erlang applications
in daemon mode:
http://www.sics.se/~joe/tutorials/web_server/web_server.html#m2

--
Mikl


--
View this message in context: http://www.nabble.com/Killing-a-detached-application-tp15719222p15738119.html
Sent from the Erlang Questions mailing list archive at Nabble.com.



Reply | Threaded
Open this post in threaded view
|

Re: Killing a detached application

Mikl Kurkov
In reply to this post by Dave Bryson-3
The problem is that you only stop application while node is stil alive.

Here is Joe tutorial with good example how to deal with erlang applications in daemon mode:
http://www.sics.se/~joe/tutorials/web_server/web_server.html#m2

--
Mikl