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

Garrett Smith g@REDACTED
Sat Jun 29 17:04:49 CEST 2013


To measure that specifically then, the two approaches that occur to me
are to either poll the target node from another node by issuing pings,
timing out after a period -- or configuring your target node to ping
back as soon as it starts.

If you don't have another node to control this (which would be odd
given your start definition) you could tail/scan a log file as a proxy
for start state. Or create a sentinel file somewhere that signals the
node is started.

This problem is endemic to coordinating system activity -- it's not
specific to run_erl (even if it blocked, you'd have the same problem
unless it fortuitously exited when you wanted it to).

On Sat, Jun 29, 2013 at 9:48 AM, Yash Ganthe
<yash_ganthe@REDACTED> 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:g@REDACTED]
> Sent: Saturday, June 29, 2013 7:43 PM
> To: Yash Ganthe
> Cc: erlang-questions@REDACTED
> 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 <yash_ganthe@REDACTED> 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
>>
>> DISCLAIMER ========== This e-mail may contain privileged and
>> confidential information which is the property of Persistent Systems
>> Ltd. It is intended only for the use of the individual or entity to
>> which it is addressed. If you are not the intended recipient, you are
>> not authorized to read, retain, copy, print, distribute or use this
>> message. If you have received this communication in error, please
>> notify the sender and delete all copies of this message. Persistent
>> Systems Ltd. does not accept any liability for virus infected mails.
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.



More information about the erlang-questions mailing list