added gracefulReload support for pm2

This commit is contained in:
cubedro 2015-02-18 06:39:33 +02:00
parent fb5a1de8a2
commit 1feeab33b9
1 changed files with 5 additions and 1 deletions

6
app.js
View File

@ -10,7 +10,7 @@ var gracefulShutdown = function() {
setTimeout(function(){
console.log("Closed out remaining connections.");
process.exit()
process.exit(0)
}, 2*1000);
}
@ -20,5 +20,9 @@ process.on('SIGTERM', gracefulShutdown);
// listen for INT signal e.g. Ctrl-C
process.on('SIGINT', gracefulShutdown);
process.on('message', function(msg) {
if (msg == 'shutdown')
gracefulShutdown();
});
module.exports = node;