[erlang-questions] Best approach to stop distributed erlang apps

Rick Pettit rpettit@REDACTED
Wed May 14 22:34:09 CEST 2008


On Wed, May 14, 2008 2:44 pm, Dave Bryson wrote:
> I have an application distributed across X number of machines in a
> cluster.  I'm currently launching the apps in a -detached mode. To
> launch the apps, I'm using a shell script that loops through the nodes
> and runs a start script via SSH.  I'd like to be able to do the same
> thing to stop the apps ( completely stop the erlang runtime
> init:stop() ).  However, I  haven't been able to figure out the best
> approach to do that.  The only thing I've been successful with is to -
> remsh into each application and call "init:stop()".
>
> Does anyone have a "best practice" approach to automate calling
> init:stop() across a cluster?

If order doesn't matter and a clean shutdown which flushes all I/O isn't
required you should be able to do something like:

  StopNode=fun(N) -> rpc:call(N,init,stop,[]) end,
  lists:foreach(StopNode, nodes()).

-Rick

P.S. I have not tested the code above :-)




More information about the erlang-questions mailing list