title: How to write a script for starting nodemon and mongod
body: <p>I want to make a bash file that automatically runs nodemon and mongod.
  I have the following code:</p>
  
  <pre><code>#!/usr/bin/env bash
  
  workingDirectory="$(pwd)/"
  serverFolder="${workingDirectory}first-app/caffeineOverflow"
  
  cd "${serverFolder}"
  mongod &amp;
  export caffeine_overflow_jwtPrivateKey=ok 
  nodemon &amp; 
  </code></pre>
  
  <p>I run it with sudo so that I can run mongod. I get the following error: 
  exception in initAndListen: DBPathInUse: Unable to lock the lock file: /data/db/mongod.lock (Resource temporarily unavailable). Another mongod instance is already running on the /data/db directory, terminating</p>
  
  <p>What should i do in order for this code to run?</p>