MXS-620: Add start/stop maxscale to MaxCtrl

The commands allow all services in MaxScale to be either stopped or
started.
This commit is contained in:
Markus Mäkelä
2017-08-22 14:43:14 +03:00
parent ae5260bec7
commit cbe58b5355
3 changed files with 33 additions and 1 deletions

View File

@ -27,6 +27,20 @@ exports.builder = function(yargs) {
return doRequest(host, 'monitors/' + argv.name + '/start', null, {method: 'PUT'})
})
})
.command('maxscale', 'Start MaxScale by starting all services', {}, function(argv) {
maxctrl(argv, function(host) {
return doRequest(host, 'services/', function(res) {
var promises = []
res.data.forEach(function(i) {
promises.push(doRequest(host, 'services/' + i.id + '/start', null, {method: 'PUT'}))
})
return Promise.all(promises)
.then(() => OK())
})
})
})
.usage('Usage: start <command>')
.help()
.command('*', 'the default command', {}, function(argv) {