From 20dc3127b106e18b41573299f75d75c6b77f958d Mon Sep 17 00:00:00 2001 From: Jan Kunzmann Date: Fri, 20 Jan 2017 02:13:09 +0100 Subject: [PATCH] Handle SIGTERM the same way SIGINT is handled --- app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 7b5e619..ba0b67d 100644 --- a/app.js +++ b/app.js @@ -626,8 +626,8 @@ process.on('uncaughtException', function (err) { process.exit(1); }); -// gracefully exit -process.on('SIGINT', function () { +// install exit handler +function handleTermSignals() { config.maintenance = true; // disconnect all socket.io clients Object.keys(io.sockets.sockets).forEach(function (key) { @@ -649,4 +649,6 @@ process.on('SIGINT', function () { }); } }, 100); -}); +} +process.on('SIGINT', handleTermSignals); +process.on('SIGTERM', handleTermSignals);