Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pause command in elasticsearch.in.bat not friendly to automated processes #8913

Closed
garvincasimir opened this issue Dec 12, 2014 · 9 comments · Fixed by #9160
Closed

Pause command in elasticsearch.in.bat not friendly to automated processes #8913

garvincasimir opened this issue Dec 12, 2014 · 9 comments · Fixed by #9160
Assignees

Comments

@garvincasimir
Copy link

I am using Elasticsearch in a project which is intended to run it in Azure Worker roles. I run a series of configuration tasks to install java then configure elasticsearch and run it. The problem is when the batch script does not find JAVA_HOME it pauses instead of throwing an error and returning an exit code. Because of this I will assume that this batch script is geared towards people who intend to run elasticsearch manually. I propose a similar batch script elasticsearch-headless.bat which can be initiated by other automated processes.

I realize that there is a service.bat but I would lose too much control if I installed Elasticsearch as a service. The runtime needs to respond immediately if the process crashes for example.

@tlrx
Copy link
Member

tlrx commented Dec 12, 2014

Instead of adding another script, maybe can we add a quiet/silent option to the existing script?

Something like elasticsearch.bat /s

@dadoonet
Copy link
Member

Could we detect that JAVA_HOME is not set and fail?

@tlrx
Copy link
Member

tlrx commented Dec 12, 2014

@dadoonet That's already the case. The issue here is a PAUSE command right after detecting that JAVA_HOME is not present.

@dadoonet
Copy link
Member

@garvincasimir
Copy link
Author

@dadoonet @tlrx In addition to removing the pause command, the script should

  • return an error code more than 0
  • pipe the "JAVA_HOME is missing" message to standard error

I can do some testing based on an /s switch but it is complicated by the fact that elasticsearch.in.bat is an inner script.

@garvincasimir
Copy link
Author

Related to this, does anyone know if JAVA_HOME is only required to start elasticsearch in the script or is it also used by some other internals? If it is the former then maybe we can add an optional parameter for the JAVA_HOME path.

@tlrx
Copy link
Member

tlrx commented Dec 19, 2014

@garvincasimir AFAIK it is only necessary for start/stop scripts.

@tlrx
Copy link
Member

tlrx commented Jan 6, 2015

@garvincasimir just to keep you informed: the pull request #9160 adds the --silent option.

@garvincasimir
Copy link
Author

Awesome! Can't wait to incorporate this into my project! Thanks @tlrx

tlrx added a commit to tlrx/elasticsearch that referenced this issue Jan 12, 2015
On Windows platforms when JAVA_HOME is not defined, a message is printed on standard output and the bat script is paused until the user press a key. This behavior is not compliant to automated processes where elasticsearch.bat can be executed by another script. This commit adds a new parameter --silent / -s that allow to skip the pause. Also, the error message is directed to standard and error outputs.

 Closes elastic#8913
tlrx added a commit that referenced this issue Jan 12, 2015
On Windows platforms when JAVA_HOME is not defined, a message is printed on standard output and the bat script is paused until the user press a key. This behavior is not compliant to automated processes where elasticsearch.bat can be executed by another script. This commit adds a new parameter --silent / -s that allow to skip the pause. Also, the error message is directed to standard and error outputs.

 Closes #8913

(cherry picked from commit 261eb5b)
tlrx added a commit that referenced this issue Jan 12, 2015
On Windows platforms when JAVA_HOME is not defined, a message is printed on standard output and the bat script is paused until the user press a key. This behavior is not compliant to automated processes where elasticsearch.bat can be executed by another script. This commit adds a new parameter --silent / -s that allow to skip the pause. Also, the error message is directed to standard and error outputs.

 Closes #8913

(cherry picked from commit 261eb5b)
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
On Windows platforms when JAVA_HOME is not defined, a message is printed on standard output and the bat script is paused until the user press a key. This behavior is not compliant to automated processes where elasticsearch.bat can be executed by another script. This commit adds a new parameter --silent / -s that allow to skip the pause. Also, the error message is directed to standard and error outputs.

 Closes elastic#8913

(cherry picked from commit 261eb5b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants