title: Jenkins kill all child processes
body: <p>I have a jenkins job that runs a bash script.</p>
  
  <p>In the bash script I perform effectively two actions, something like</p>
  
  <pre><code>java ApplicationA &amp;
  PID_A=$!
  java ApplicationB
  kill $PID_A   
  </code></pre>
  
  <p>but if the job is manually aborted, the <code>ApplicationA</code> remains alive (as can be seen with a <code>ps -ef</code> on the node machine). I cannot use trapping and so on, because that won't work if jenkins sends a <code>9</code> signal (trapping doesn't work for <code>9</code>).</p>
  
  <p>It would be ideal if this job could be configured to simply kill <strong>all</strong> processes that it spawns, how can I do that?</p>