Skip to content
Browse files

Merge pull request #25 from lmorchard/graceful-exit-on-sigterm

Catch SIGTERM to gracefully clean up child processes & exit
  • Loading branch information...
2 parents 8054ed2 + 4d59223 commit b57f7b56decffae788169bdb9b95016e9cff92fd @groovecoder groovecoder committed Mar 8, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 run.js
View
9 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);

0 comments on commit b57f7b5

Please sign in to comment.
Something went wrong with that request. Please try again.