[erlang-questions] Killing a detached application

Dave Bryson <>
Wed Feb 27 18:52:15 CET 2008


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 

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



More information about the erlang-questions mailing list