Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Erlang Daemon

Tags:

erlang

daemon

Besides running $ killall -9 beam.smp, how can I kill an Erlang node programmatically when I know its -sname?

If I don't want the heartbeat monitor to restart the process, how can I ensure that whatever answer is given for the above question will also kill the heartbeat?

Is there a decent guide to deploying Erlang as a daemon?

like image 923
Eli Avatar asked Jan 25 '10 06:01

Eli


People also ask

How do I stop Erlang process?

A process can terminate itself by calling one of the BIFs exit(Reason), erlang:error(Reason), erlang:error(Reason, Args), erlang:fault(Reason) or erlang:fault(Reason, Args). The process then terminates with reason Reason for exit/1 or {Reason,Stack} for the others.

What is Erlang port mapper daemon?

The erlang port mapper daemon is used to coordinate distributed erlang instances. His job is to keep track of which node name listens on which address. Hence, epmd map symbolic node names to machine addresses. Default port: 4369. PORT STATE SERVICE VERSION.

What is EPMD daemon?

EPMD (Erlang Port Mapper Daemon) messages are the messages sent between Erlang nodes and the empd process. The message formats are derived from the * lib/kernel/src/erl_epmd.* files as part of the Erlang distribution available from http://www.erlang.org/ Erlang is a functional programming language.

What is an Erlang node?

A node is an executing Erlang runtime system that has been given a name, using the command-line flag -name (long names) or -sname (short names). The format of the node name is an atom name@host. name is the name given by the user.


1 Answers

kill and killall with -9 is almost always wrong.

You can quite easily ask the remote node to exit using:

rpc:call(RemoteNode, init, stop, []).

I don't know whether that'd prevent heart from restarting it, but I'd suggest that if you expect to stop it, you shouldn't run it in a don't-ever-stop mode.

Update - Zed points out that init:stop does the right thing with heart, so the above rpc:call is the best and only way to do it.

like image 99
Dustin Avatar answered Oct 22 '22 11:10

Dustin