A sample I have git push github
It is an example of application from the book Programming Erlang
you can do followREADME.md
My question is when the application sellaprime started, and I
./bin/sp restart
this will make the node down and not restart?
Erlang Doc say
The system is restarted inside the running Erlang node, which means that the emulator is not restarted. All applications are taken down smoothly, all code is unloaded, and all ports are closed before the system is booted again in the same way as initially started. The same BootArgs are used again.
What does "emulator is not restarted" mean?
If I want to restart a node, what is the right way to do?
By the way, is there any API to know the current release version, like
application:which_applications()
It looks like your sb
init script, that is using the nodetool
script should call init:restart()
for you. If this is done, but your node is instead shut down, check your logs for any possible errors (perhaps one of your applications cannot handle a restart?).
Using init:restart()
is the way to do it though. Here's an example: start an Erlang node with a name (in this case, test
):
$ erl -sname test
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.0 (abort with ^G)
(test@host)1> hello.
hello
(test@host)2>
Temporary start another node that will make an RPC call to the first node:
$ erl -sname other -noinput -noshell -eval "rpc:call('test@host', init, restart, [])" -s init stop
$
Observer the original node being restarted:
(test@host)2> Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.0 (abort with ^G)
(test@host)1>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.