[erlang-questions] Waiting for a node to start using run_erl

Fred Youhanaie <>
Sat Jun 29 22:02:23 CEST 2013


How about checking through epmd with a bash command like this?

	run_erl -daemon ...
	until epmd -names | grep 'name NODENAME at port'; do sleep 3; done;

Of course, you can turn the bash one liner into a script with optional delay and retry counts :-)

However, as Garrett said, you may be better off with a more sophisticated test that is specific to your application.

Cheers
Fred

On 29/06/13 15:48, Yash Ganthe wrote:
> My definition of "started" is that I am able to PING the node and get a PONG response back.
>
> Thanks,
> Yash
>
> -----Original Message-----
> From: Garrett Smith [mailto:]
> Sent: Saturday, June 29, 2013 7:43 PM
> To: Yash Ganthe
> Cc: 
> Subject: Re: [erlang-questions] Waiting for a node to start using run_erl
>
> What is "started" in this case?
>
> A node start is a system startup, much like an OS start. There should be a point that you system is "ready" to server/act/etc. Once you establish that point, test for for it.
>
> Just as an example of why this isn't always straight forward, consider a socket server (e.g. a web server). You might define "ready" as soon as the server is accepting connections on a port, which is easy to test for. But the server might in fact be ready several seconds later as database connections are opened, caches warmed, whatever. So a ready test might be a 200 response on a particular http request (which is able to test for all those conditions).
>
> On Sat, Jun 29, 2013 at 8:42 AM, Yash Ganthe <> wrote:
>> Hi,
>>
>>
>>
>> When staring an erl node using run_erl, if the -daemon switch is used,
>> control returns to the terminal immediately without letting me know
>> whether the node was really started.
>>
>> The switch is recommended in the documentation at:
>> http://erlang.org/doc/man/run_erl.html
>>
>>
>>
>> It says: Without this option, run_erl must be started using several
>> tricks in the shell to detach it completely from the terminal in use
>> when starting it.
>>
>>
>>
>> Is there a way to use run_erl and ensure that the node is started.
>> This would be especially useful when starting the node from a shell
>> script using run_erl.
>>
>>
>>
>> Thanks,
>>
>> Yash
>>



More information about the erlang-questions mailing list