fix webserver service check

This commit is contained in:
Iuri Matias 2017-12-17 18:58:55 -05:00
parent 113bb25142
commit 14d330a729
2 changed files with 13 additions and 3 deletions

View File

@ -178,8 +178,18 @@ class Engine {
});
self.servicesMonitor.addCheck('Webserver', function (cb) {
let devServer = 'Webserver (http://' + host + ':' + port + ')';
return cb({name: devServer, status: 'on'});
utils.checkIsAvailable('http://' + host + ':' + port, function (available) {
let devServer = 'Webserver (http://' + host + ':' + port + ')';
if (available) {
return cb({name: devServer, status: 'on'});
} else {
return cb({name: devServer, status: 'off'});
}
});
});
self.events.on('check:wentOffline:Webserver', function () {
self.logger.info("Webserver is offline");
});
self.events.setCommandHandler('start-webserver', function() {

View File

@ -45,7 +45,7 @@ class Console {
utils.exit();
} else if (cmd === 'webserver start') {
this.events.request("start-webserver");
return "starting webserver...";
return " ";
} else if (cmd === 'webserver stop') {
this.events.request("stop-webserver");
return "stopping webserver...";