[add] option:single-run

This commit is contained in:
Christian Fraß 2025-04-29 20:19:45 +00:00
parent 7f6f080bea
commit 29e8daa719

View file

@ -107,8 +107,10 @@ namespace _munin
async function run(
conf : _munin.conf.type_conf,
{
"single_run": single_run = false,
"dry_run": dry_run = false,
} : {
single_run ?: boolean;
dry_run ?: boolean;
} = {
}
@ -127,11 +129,16 @@ namespace _munin
}
}
);
if (single_run) {
await run_iteration(conf, sources, targets, {"dry_run": dry_run});
}
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",
"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({
"indicators_long": ["verbosity"],
"indicators_short": ["v"],
@ -274,6 +290,7 @@ namespace _munin
run(
conf,
{
"single_run": args.single_run,
"dry_run": args.dry_run,
}
);