From 4d59223c64631a3f811c5869126259d0f227e758 Mon Sep 17 00:00:00 2001 From: Les Orchard Date: Wed, 6 Mar 2013 13:26:38 -0500 Subject: [PATCH] Catch SIGTERM to gracefully clean up child processes & exit --- run.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/run.js b/run.js index 18bf20067..d2d8351bb 100644 --- a/run.js +++ b/run.js @@ -144,7 +144,14 @@ function runMaster () { process.exit(0); } - process.on('SIGINT', performExit); + process.on('SIGINT', function (err) { + log.info("Received SIGINT, exiting..."); + performExit(); + }); + process.on('SIGTERM', function (err) { + log.info("Received SIGTERM, exiting..."); + performExit(); + }); process.on('uncaughtException', function (err) { statsd.increment('kumascript.master_exceptions'); log.error('uncaughtException:', err.message);