diff --git a/client/maxctrl/lib/start.js b/client/maxctrl/lib/start.js new file mode 100644 index 000000000..db44cbd09 --- /dev/null +++ b/client/maxctrl/lib/start.js @@ -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 ' +exports.desc = 'Start objects' +exports.handler = function() {} +exports.builder = function(yargs) { + yargs + .command('service ', 'Start a service', {}, function(argv) { + doRequest('services/' + argv.name + '/start', null, {method: 'PUT'}) + }) + .command('monitor ', 'Start a monitor', {}, function(argv) { + doRequest('monitors/' + argv.name + '/start', null, {method: 'PUT'}) + }) + .usage('Usage: start ') + .help() + .command('*', 'the default command', {}, () => { + console.log('Unknown command. See output of `help start` for a list of commands.') + }) +} diff --git a/client/maxctrl/lib/stop.js b/client/maxctrl/lib/stop.js new file mode 100644 index 000000000..477818fcb --- /dev/null +++ b/client/maxctrl/lib/stop.js @@ -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 ' +exports.desc = 'Stop objects' +exports.handler = function() {} +exports.builder = function(yargs) { + yargs + .command('service ', 'Stop a service', {}, function(argv) { + doRequest('services/' + argv.name + '/stop', null, {method: 'PUT'}) + }) + .command('monitor ', 'Stop a monitor', {}, function(argv) { + doRequest('monitors/' + argv.name + '/stop', null, {method: 'PUT'}) + }) + .usage('Usage: stop ') + .help() + .command('*', 'the default command', {}, () => { + console.log('Unknown command. See output of `help stop` for a list of commands.') + }) +} diff --git a/client/maxctrl/maxctrl.js b/client/maxctrl/maxctrl.js index 268a3601b..c6fab50c5 100644 --- a/client/maxctrl/maxctrl.js +++ b/client/maxctrl/maxctrl.js @@ -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', {}, () => {