From 0ba67481fbf9bb658ee81c7a30eacac6004f5096 Mon Sep 17 00:00:00 2001 From: XeonCore Date: Sun, 12 Oct 2014 17:52:51 +1100 Subject: [PATCH] Listen to SIGHUP and reload users Listens for a 'SIGHUP' signal and reloads users when it gets one. The signal won't be listened to if its running on Windows as a SIGHUP indicates a console window closing. --- src/clientManager.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/clientManager.js b/src/clientManager.js index c88d241b..2f437969 100644 --- a/src/clientManager.js +++ b/src/clientManager.js @@ -8,7 +8,14 @@ var moment = require("moment"); module.exports = ClientManager; function ClientManager() { + var self = this; this.clients = []; + if(!/^win/.test(process.platform)) { + process.on('SIGHUP', function() { + console.log("Received 'SIGHUP'. Reloading Users."); + self.loadUsers(); + }); + } } ClientManager.prototype.findClient = function(name) {