node.jssignalsnode-supervisor

which signal did supervisor send to express.js to restart the server


All:

[UPDATE]: Some posts mentioned that: In windows, there is no signal mechanism, so "SIGINT" can not work in Windows Node.js

I got one question when I deal with express termination:

I want to detect the shutdown signal of express server, so I set these:

process.on('exit', function(code) {
  console.log("exit disconnect.");
});

process.on('SIGINT', function(code){
  console.log("interrupt disconnect.");
});

process.on('SIGQUIT', function(code){
  console.log("quit disconnect.");
});

in bin/www. And start the server with supervisor bin/www

but when I use supervisor to monitor and restart the server, none of them get called, could anyone tell me which signal I should bind to process to monitor the shutdown of server?

Thanks


Solution

  • Supervisor doesn't support sending signals to end a process.

    Look here: https://github.com/Supervisor/supervisor/issues/53