title: node.js pm2 on exit
body: <p>I'm using pm2 to running node application. I must save data before application will be closed. This code works fine in shell:</p>
  
  <pre><code>process.on('exit', function(){
      log.debug('exit');
  });
  
  process.on('SIGINT', function(){
      log.debug('SIGINT');
  });
  
  process.on('uncaughtException', function(){
      log.debug('uncaughtException');
  });
  </code></pre>
  
  <p>When I'm stopping the application using "pm2 stop" the code doesn't work. I think that pm2 kills process. </p>