check with jps that the pid file contains a pid that actually is an elasticsearch process

relates to #12063
This commit is contained in:
Britta Weber 2015-08-18 15:40:41 +02:00
parent c3b3b0e6f8
commit f031c17681
1 changed files with 21 additions and 2 deletions

View File

@ -227,6 +227,27 @@
<extract-pid file="@{es.pidfile}" property="integ.pid"/> <extract-pid file="@{es.pidfile}" property="integ.pid"/>
<echo>Shutting down external node PID ${integ.pid}</echo> <echo>Shutting down external node PID ${integ.pid}</echo>
<!-- verify with jps that this actually is the correct pid.
See if we can find the line "pid org.elasticsearch.bootstrap.Elasticsearch" in the output of jps -l.-->
<exec executable="jps">
<arg value="-l"/>
<redirector outputproperty="jps.pid.line">
<outputfilterchain>
<linecontains>
<contains value="${integ.pid} org.elasticsearch.bootstrap.Elasticsearch"/>
</linecontains>
</outputfilterchain>
</redirector>
</exec>
<fail
message="pid file at @{es.pidfile} is ${integ.pid} but jps -l did not report any process with org.elasticsearch.bootstrap.Elasticsearch and this pid.
Did you run mvn clean? Maybe an old pid file is still lying around.">
<condition>
<not>
<isset property="jps.pid.line"/>
</not>
</condition>
</fail>
<exec executable="taskkill" failonerror="true" osfamily="winnt"> <exec executable="taskkill" failonerror="true" osfamily="winnt">
<arg value="/F"/> <arg value="/F"/>
@ -279,8 +300,6 @@
<startup-elasticsearch/> <startup-elasticsearch/>
</target> </target>
<!-- TODO, for some more safety, add back some of the old jps logic
and verify the pid is really an ES process! (fail otherwise) -->
<target name="stop-external-cluster" if="integ.pidfile.exists"> <target name="stop-external-cluster" if="integ.pidfile.exists">
<stop-node/> <stop-node/>
</target> </target>