title: How do I stop the previous command in a bash script?
body: <p>I'm trying to build a bash script that runs unit tests on a web server.  </p>
  
  <p>I wish to run a simple bash script that could be (for example) in a makefile that does the following:</p>
  
  <ol>
  <li>Start a web server</li>
  <li>Run the unit tests</li>
  <li>Stop the web server</li>
  </ol>
  
  <p>Assuming that the web server is written for NodeJS, here's what it could look like:</p>
  
  <pre><code>npm start &amp;
  sleep 5
  npm test
  </code></pre>
  
  <p>The issue with this approach is that the web server will keep on running. How do I stop it after the <code>npm test</code> stage?</p>