Stop Erlang Daemon

爷,独闯天下 提交于 2019-12-22 05:09:14

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/2130644/stop-erlang-daemon

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!