From 14d330a72916196f19e6dff8a5210c02d3eb328f Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 17 Dec 2017 18:58:55 -0500 Subject: [PATCH] fix webserver service check --- lib/core/engine.js | 14 ++++++++++++-- lib/dashboard/console.js | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/core/engine.js b/lib/core/engine.js index 00b6206ed..8bb96a623 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -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() { diff --git a/lib/dashboard/console.js b/lib/dashboard/console.js index 488394915..be6ba7da5 100644 --- a/lib/dashboard/console.js +++ b/lib/dashboard/console.js @@ -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...";