elasticsearch/elasticsearch — pull request #8742 by t-lo (2014-12-02 15:30:27+00:00)
Title: background start-up: use PID file to signal success

This change introduces the use of elasticsearch's PID file to signal a
successful start-up. The start script `bin/elasticsearch` will wait a
configurable amount of time (default: 120s) for the PID file to appear. After
this timed out the script will print an error and return an error code.

Note that if no PID file was specified on the command line the script will now
use `mktemp` to create a "private" PID file (only if ES is to be started in the
background, though). The command line help was updated correspondingly.

Also, the PID file generation code has been moved from the beginning of the
bootstrap `main()` method to the end.

Fixes #8652.

**NOTE**
Please review my changes to `src/main/java/org/elasticsearch/bootstrap/Bootstrap.java` very closely; I'm not too familiar with ES code and am not sure if I broke something.

**NOTE 2**
This change introduces a (theoretical) new error condition: If elasticsearch requires longer than the timeout to bootstrap, a "false positive" start-up error will be reported by the script even though elasticsearch will be up and running eventually. This can be worked around by setting an appropriately long timeout via the new `-w` command line option.