[add] option:single-run
This commit is contained in:
parent
7f6f080bea
commit
29e8daa719
|
@ -107,8 +107,10 @@ namespace _munin
|
||||||
async function run(
|
async function run(
|
||||||
conf : _munin.conf.type_conf,
|
conf : _munin.conf.type_conf,
|
||||||
{
|
{
|
||||||
|
"single_run": single_run = false,
|
||||||
"dry_run": dry_run = false,
|
"dry_run": dry_run = false,
|
||||||
} : {
|
} : {
|
||||||
|
single_run ?: boolean;
|
||||||
dry_run ?: boolean;
|
dry_run ?: boolean;
|
||||||
} = {
|
} = {
|
||||||
}
|
}
|
||||||
|
@ -127,9 +129,14 @@ namespace _munin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
while (true) {
|
if (single_run) {
|
||||||
await run_iteration(conf, sources, targets, {"dry_run": dry_run});
|
await run_iteration(conf, sources, targets, {"dry_run": dry_run});
|
||||||
await lib_plankton.call.sleep(conf.settings.interval * 60 * 60);
|
}
|
||||||
|
else {
|
||||||
|
while (true) {
|
||||||
|
await run_iteration(conf, sources, targets, {"dry_run": dry_run});
|
||||||
|
await lib_plankton.call.sleep(conf.settings.interval * 60 * 60);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +178,15 @@ namespace _munin
|
||||||
"info": "whether to expose the full configuration",
|
"info": "whether to expose the full configuration",
|
||||||
"name": "conf-expose",
|
"name": "conf-expose",
|
||||||
}),
|
}),
|
||||||
|
"single_run": lib_plankton.args.class_argument.volatile({
|
||||||
|
"indicators_long": ["single-run"],
|
||||||
|
"indicators_short": ["s"],
|
||||||
|
"type": lib_plankton.args.enum_type.boolean,
|
||||||
|
"mode": lib_plankton.args.enum_mode.replace,
|
||||||
|
"default": false,
|
||||||
|
"info": "whether to only execute on iteration at run",
|
||||||
|
"name": "single-run",
|
||||||
|
}),
|
||||||
"verbosity": lib_plankton.args.class_argument.volatile({
|
"verbosity": lib_plankton.args.class_argument.volatile({
|
||||||
"indicators_long": ["verbosity"],
|
"indicators_long": ["verbosity"],
|
||||||
"indicators_short": ["v"],
|
"indicators_short": ["v"],
|
||||||
|
@ -274,6 +290,7 @@ namespace _munin
|
||||||
run(
|
run(
|
||||||
conf,
|
conf,
|
||||||
{
|
{
|
||||||
|
"single_run": args.single_run,
|
||||||
"dry_run": args.dry_run,
|
"dry_run": args.dry_run,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue