title: How to kill all subprocesses of shell?
body: <p>I'm writing a bash script, which does several things.</p>
  
  <p>In the beginning it starts several monitor scripts, each of them runs some other tools.</p>
  
  <p>At the end of my main script, I would like to kill all things that were spawned from my shell.</p>
  
  <p>So, it might looks like this:</p>
  
  <pre><code>#!/bin/bash
  
  some_monitor1.sh &amp;
  some_monitor2.sh &amp;
  some_monitor3.sh &amp;
  
  do_some_work
  ...
  
  kill_subprocesses
  </code></pre>
  
  <p>The thing is that most of these monitors spawn their own subprocesses, so doing (for example): <code>killall some_monitor1.sh</code> will not always help.</p>
  
  <p>Any other way to handle this situation?</p>