<p dir="auto">With RESTART_ON_UPGRADE disabled (default for at least 1.5.2), the init script of ES 1.7.x will be unable to restart ES after a Debian package upgrade from 1.5.x or earlier.</p>
<p dir="auto">This is because the pid file path changed in 1.6.0 (IIRC), so when a user invokes e.g. <code class="notranslate">/etc/init.d/elasticsearch restart</code> after the package has been upgraded no pid file is found and ES is deemed to not be running. The subsequent start will then fail since it can't bind to any ports as they're still busy by the running ES process.</p>
<p dir="auto">This broke my automated upgrade from 1.5.2 to 1.7.1, requiring a manual shutdown of ES on affected machines and/or a package rollback. Could we try a little harder to find the pid file by e.g. introducing a fallback pid file in the 1.7.x series? Perhaps migrating the old pid file with something as simple as</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="LEGACY_PID_FILE=&quot;/var/run/elasticsearch.pid&quot;
if [ -f &quot;$LEGACY_PID_FILE&quot; -a &quot;$LEGACY_PID_FILE&quot; != &quot;$PID_FILE&quot; ] ; then 
        mv &quot;$LEGACY_PID_FILE&quot; &quot;$PID_FILE&quot; || exit 1
fi"><pre class="notranslate"><code class="notranslate">LEGACY_PID_FILE="/var/run/elasticsearch.pid"
if [ -f "$LEGACY_PID_FILE" -a "$LEGACY_PID_FILE" != "$PID_FILE" ] ; then 
        mv "$LEGACY_PID_FILE" "$PID_FILE" || exit 1
fi
</code></pre></div>
<p dir="auto">right after the PID_DIR creation in /etc/init.d/elasticsearch would do?</p>
<p dir="auto">Using repository install on Ubuntu 14.04 LTS</p>
<p dir="auto">Sequence to reproduce.</p>
<ul dir="auto">
<li>Install 1.5.2</li>
<li>Upgrade to 1.6.0</li>
<li>Run <code class="notranslate">service elasticsearch stop</code></li>
</ul>
<p dir="auto">init.d script returns "[ OK ]" (indicates that process has been stopped), but process list shows process is still running.  If you manually kill the process, the init.d script then successfully start/stops</p>