Spawning process in background on Jenkins - job that won't stay in queue
<p>I want to make job on Jenkins that starts server (MockServer on WireMock).</p>

<p>Server is launched from *.jar file, from terminal like that.</p>

<pre><code>java -jar serverLaunch.jar
</code></pre>

<p>It takes over my console. To avoid that I modify this and do:</p>

<pre><code>java -jar serverLaunch.jar &amp;&gt;/dev/null &amp;
</code></pre>

<p>And that works for me on my local PC. Now I want to move it to Jenkins.</p>

<p>If I try to do this from "Shell command" block in Jenkins Job then:</p>

<p>a) <code>java -jar serverLaunch.jar</code></p>

<ul>
<li>I have task locked in queue in my Jenkins and I don't want that but server starts and works.</li>
</ul>

<p>b) <code>java -jar serverLaunch.jar &amp;&gt;/dev/null &amp;</code></p>

<ul>
<li>Job ends with success but my server is not alive. </li>
</ul>

<p>I have wrapped this command also in .sh script and .rb script. Any idea how to make it work?</p>

<hr>

<p>I've tried this: 
<a href="https://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build" rel="nofollow noreferrer">https://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build</a></p>

<p>And then in Jenkins "Shell script":</p>

<pre><code>daemonize -E BUILD_ID=dontKillMe /bin/bash launch.sh
</code></pre>

<p>But it also passes but server is not alive.</p>