title: How to only restart node process with PM2 if exit code != 0
body: <p>I'm using <a href="http://pm2.keymetrics.io/" rel="noreferrer">pm2</a> to manage a node process. 
  Currently, pm2 restarts the node process even if it finishes cleanly (with exit code 0). I don't want that to happen. </p>
  
  <p>Instead I only want PM2 to restart the app when the node process exits with a code != 0. </p>
  
  <p>How to do this?</p>
  
  <p>The pm2 logs might be useful: </p>
  
  <pre><code>PM2        | App [xxx] with id [0] and pid [44797], exited with code [0] via signal [SIGINT]
  PM2        | Starting execution sequence in -fork mode- for app name:xxx id:0
  PM2        | App name:xxx id:0 online
  </code></pre>
  
  <p><strong>EDIT</strong>: </p>
  
  <p>Seems that starting process in cluster-mode works as I expect. I.e.: restarts only happen on exit-codes !=0. </p>
  
  <p>Still starting in fork-mode gives the unexpected behavior as described above.</p>