mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
Add instance restart to ctl
This commit is contained in:
1 file changed
+17
-2
@@ -1038,17 +1038,32 @@ instanceCommands.add(new lib.Command({
|
|||||||
definition: ["start <instance>", "Start instance", (yargs) => {
|
definition: ["start <instance>", "Start instance", (yargs) => {
|
||||||
yargs.positional("instance", { describe: "Instance to start", type: "string" });
|
yargs.positional("instance", { describe: "Instance to start", type: "string" });
|
||||||
yargs.options({
|
yargs.options({
|
||||||
"save": { describe: "Save load, defaults to latest", nargs: 1, type: "string" },
|
"save": { describe: "Save to load, defaults to latest", nargs: 1, type: "string" },
|
||||||
"keep-open": { describe: "Keep console open", nargs: 0, type: "boolean", default: false },
|
"keep-open": { describe: "Keep console open", nargs: 0, type: "boolean", default: false },
|
||||||
});
|
});
|
||||||
}],
|
}],
|
||||||
handler: async function(args: { instance: string, save?: string, keepOpen: boolean }, control: Control) {
|
handler: async function(args: { instance: string, save?: string, keepOpen: boolean }, control: Control) {
|
||||||
let instanceId = await lib.resolveInstance(control, args.instance);
|
const instanceId = await lib.resolveInstance(control, args.instance);
|
||||||
await control.setLogSubscriptions({ instanceIds: [instanceId] });
|
await control.setLogSubscriptions({ instanceIds: [instanceId] });
|
||||||
await control.sendTo({ instanceId }, new lib.InstanceStartRequest(args.save));
|
await control.sendTo({ instanceId }, new lib.InstanceStartRequest(args.save));
|
||||||
control.keepOpen = args.keepOpen;
|
control.keepOpen = args.keepOpen;
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
instanceCommands.add(new lib.Command({
|
||||||
|
definition: ["restart <instance>", "Restart instance", (yargs) => {
|
||||||
|
yargs.positional("instance", { describe: "Instance to restart", type: "string" });
|
||||||
|
yargs.options({
|
||||||
|
"save": { describe: "Save to load, defaults to latest", nargs: 1, type: "string" },
|
||||||
|
"keep-open": { describe: "Keep console open", nargs: 0, type: "boolean", default: false },
|
||||||
|
});
|
||||||
|
}],
|
||||||
|
handler: async function(args: { instance: string, save?: string, keepOpen: boolean }, control: Control) {
|
||||||
|
const instanceId = await lib.resolveInstance(control, args.instance);
|
||||||
|
await control.setLogSubscriptions({ instanceIds: [instanceId] });
|
||||||
|
await control.sendTo({ instanceId }, new lib.InstanceRestartRequest(args.save));
|
||||||
|
control.keepOpen = args.keepOpen;
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
instanceCommands.add(new lib.Command({
|
instanceCommands.add(new lib.Command({
|
||||||
definition: ["load-scenario <instance> <scenario>", "Start instance by loading a scenario", (yargs) => {
|
definition: ["load-scenario <instance> <scenario>", "Start instance by loading a scenario", (yargs) => {
|
||||||
|
|||||||
Reference in new issue
Block a user