MXS-1300: Add start/stop commands
Added start and stop commands for starting and stopping services and monitors.
This commit is contained in:
31
client/maxctrl/lib/start.js
Normal file
31
client/maxctrl/lib/start.js
Normal 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.')
|
||||||
|
})
|
||||||
|
}
|
31
client/maxctrl/lib/stop.js
Normal file
31
client/maxctrl/lib/stop.js
Normal 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.')
|
||||||
|
})
|
||||||
|
}
|
@ -60,6 +60,8 @@ program
|
|||||||
.command(require('./lib/destroy.js'))
|
.command(require('./lib/destroy.js'))
|
||||||
.command(require('./lib/link.js'))
|
.command(require('./lib/link.js'))
|
||||||
.command(require('./lib/unlink.js'))
|
.command(require('./lib/unlink.js'))
|
||||||
|
.command(require('./lib/start.js'))
|
||||||
|
.command(require('./lib/stop.js'))
|
||||||
.help()
|
.help()
|
||||||
.demandCommand(1, 'At least one command is required')
|
.demandCommand(1, 'At least one command is required')
|
||||||
.command('*', 'the default command', {}, () => {
|
.command('*', 'the default command', {}, () => {
|
||||||
|
Reference in New Issue
Block a user