MXS-1300: Add start/stop commands

Added start and stop commands for starting and stopping services and
monitors.
This commit is contained in:
Markus Mäkelä 2017-07-06 14:25:28 +03:00
parent a0e7a97729
commit 252022534c
3 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2020-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
require('../common.js')()
exports.command = 'start <command>'
exports.desc = 'Start objects'
exports.handler = function() {}
exports.builder = function(yargs) {
yargs
.command('service <name>', 'Start a service', {}, function(argv) {
doRequest('services/' + argv.name + '/start', null, {method: 'PUT'})
})
.command('monitor <name>', 'Start a monitor', {}, function(argv) {
doRequest('monitors/' + argv.name + '/start', null, {method: 'PUT'})
})
.usage('Usage: start <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help start` for a list of commands.')
})
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2020-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
require('../common.js')()
exports.command = 'stop <command>'
exports.desc = 'Stop objects'
exports.handler = function() {}
exports.builder = function(yargs) {
yargs
.command('service <name>', 'Stop a service', {}, function(argv) {
doRequest('services/' + argv.name + '/stop', null, {method: 'PUT'})
})
.command('monitor <name>', 'Stop a monitor', {}, function(argv) {
doRequest('monitors/' + argv.name + '/stop', null, {method: 'PUT'})
})
.usage('Usage: stop <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help stop` for a list of commands.')
})
}

View File

@ -60,6 +60,8 @@ program
.command(require('./lib/destroy.js'))
.command(require('./lib/link.js'))
.command(require('./lib/unlink.js'))
.command(require('./lib/start.js'))
.command(require('./lib/stop.js'))
.help()
.demandCommand(1, 'At least one command is required')
.command('*', 'the default command', {}, () => {