title: pm2 running on EC2 using jenkins not working?
body: <p>I am running my node application on AWS EC2 server. 
  For continuous integration I installed Jenkins, on EC2, jenkins polls a code commit continuously and when a commit occurs executes some commands written in a script. </p>
  
  <p>The last command is </p>
  
  <p><strong>pm2 start server.js</strong></p>
  
  <p>Everything works fine and the build is shown successful but later when I access the URL the site doesn't show.</p>
  
  <p>I have a nginx server in front of node server, it gives 
  <strong>502 Bad Gateway</strong></p>
  
  <p>On checking I realised the node application is not running, so I cehcked pm2 logs and found this happening - </p>
  
  <p><strong>2016-08-12 07:53:28: [[[[ PM2/God daemon launched ]]]]</strong></p>
  
  <p><strong>2016-08-12 07:53:28: BUS system [READY] on port /var/lib/jenkins/.pm2/pub.sock</strong></p>
  
  <p><strong>2016-08-12 07:53:28: RPC interface [READY] on port /var/lib/jenkins/.pm2/rpc.sock</strong></p>
  
  <p><strong>2016-08-12 07:53:28: Starting execution sequence in -fork mode- for app name:server id:0</strong></p>
  
  <p><strong>2016-08-12 07:53:28: App name:server id:0 online</strong></p>
  
  <p><strong>2016-08-12 07:53:28: pm2 has been killed by signal, dumping process list before exit...</strong></p>
  
  <p><strong>2016-08-12 07:53:28: Deleting process 0</strong></p>
  
  <p><strong>2016-08-12 07:53:28: Stopping app:server id:0</strong></p>
  
  <p><strong>2016-08-12 07:53:28: App [server] with id [0] and pid [25822], exited with code [0] via signal [SIGTERM]</strong></p>
  
  <p><strong>2016-08-12 07:53:28: Proc is not defined anymore or is being killed</strong></p>
  
  <p><strong>2016-08-12 07:53:28: [PM2] Exited peacefully</strong></p>
  
  <p>pm2 is getting killed as soon as starting, don't know why, tried reinstalling pm2 from npm didn't work. </p>
  
  <p>Ubuntu 14.04 LTS</p>
  
  <p>Node   v4.4.7 LTS</p>
  
  <p>npm    v2.15.8</p>
  
  <p>pm2    v1.1.3</p>
  
  <p>Work is halted, need help immediately, please.</p>