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.
This commit is contained in:
XeonCore 2014-10-12 17:52:51 +11:00
parent 40f8a4ddc4
commit 0ba67481fb

View File

@ -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) {