Node.js pm2 on exit
I am using pm2 to run a node app. I have to save the data before the application is closed. This code works fine in a shell:
process.on('exit', function(){
log.debug('exit');
});
process.on('SIGINT', function(){
log.debug('SIGINT');
});
process.on('uncaughtException', function(){
log.debug('uncaughtException');
});
When I stop the application using "pm2 stop" the code doesn't work. I think pm2 is killing the process.
+3
source to share
1 answer