title: Using PM2 to run a complete development environment
body: <p>I'm using <a href="https://github.com/Unitech/pm2" rel="nofollow">PM2</a> to run my Node microservices, and in development I would also like to start MongoDB so that I can be up and running for development with a single command. I have a development ecosystem.js file that looks something like this:</p>
  
  <pre><code>apps: [
          {
              name: 'API',
              script: 'index.js',
              out_file: './logs/api.stdout.log',
              error_file: './logs/api.stderr.log'
          },
          {
              name: 'Emailer',
              script: 'services/emailer/index.js',
              out_file: './logs/emailer.stdout.log',
              error_file: './logs/emailer.stderr.log'
          },
          {
              name: 'MongoDB',
              script: 'services/development/mongodb.sh'
          }
      ]
  </code></pre>
  
  <p>and <code>mongodb.sh</code> looks like this:</p>
  
  <pre><code>#!/bin/bash
  mongod
  </code></pre>
  
  <p>When I start PM2, everything runs just fine. When I call <code>pm2 stop all</code>, it kills the node processes, but doesn't kill MongoDB.</p>
  
  <p>I'm guessing that this is because it's attaching to the bash instance, not the mongod instance. Is there a way to make PM2 start and attach to an executable, rather than a script file?</p>