Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
Catch SIGTERM to gracefully clean up child processes & exit
Browse files Browse the repository at this point in the history
  • Loading branch information
lmorchard committed Mar 7, 2013
1 parent d8cb043 commit 4d59223
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion run.js
Expand Up @@ -144,7 +144,14 @@ function runMaster () {
process.exit(0); 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) { process.on('uncaughtException', function (err) {
statsd.increment('kumascript.master_exceptions'); statsd.increment('kumascript.master_exceptions');
log.error('uncaughtException:', err.message); log.error('uncaughtException:', err.message);
Expand Down

0 comments on commit 4d59223

Please sign in to comment.