Skip to content

Commit

Permalink
Add signal and exit logging
Browse files Browse the repository at this point in the history
  • Loading branch information
smfreegard committed Nov 19, 2012
1 parent f662f34 commit fa4d261
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions haraka.js
Expand Up @@ -38,6 +38,19 @@ process.on('uncaughtException', function (err) {
process.exit(1);
});

['SIGTERM', 'SIGINT'].forEach(function (sig) {
logger.logcrit('registering handler: ' + sig);
process.on(sig, function () {
logger.logcrit(sig + ' received');
logger.dump_logs(1);
});
});

process.on('exit', function() {
logger.logcrit('Shutting down');
logger.dump_logs();
});

logger.log("INFO", "Starting up Haraka version " + exports.version);

server.createServer();

0 comments on commit fa4d261

Please sign in to comment.