This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
daniel gerrit-no-reply at lists.osmocom.orgdaniel has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sysmon/+/16002 ) Change subject: Add oneshot mode that exits after one iteration ...................................................................... Add oneshot mode that exits after one iteration Change-Id: Id920c4afee633b8da6919b7b318f9c868890a176 --- M src/osysmon_main.c 1 file changed, 11 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved laforge: Looks good to me, approved diff --git a/src/osysmon_main.c b/src/osysmon_main.c index fb01f5e..07a065e 100644 --- a/src/osysmon_main.c +++ b/src/osysmon_main.c @@ -118,6 +118,7 @@ static void print_help() { printf(" -h --help This text.\n"); + printf(" -o --oneshot Oneshot mode. Execute queries once, then exit.\n"); printf(" -c --config-file filename The config file to use.\n"); printf(" -d option --debug=DRLL:DCC:DMM:DRR:DRSL:DNM Enable debugging.\n"); printf(" -D --daemonize Fork the process into a background daemon.\n"); @@ -130,9 +131,11 @@ static struct { const char *config_file; bool daemonize; + bool oneshot; } cmdline_opts = { .config_file = "osmo-sysmon.cfg", .daemonize = false, + .oneshot = false, }; static void handle_options(int argc, char **argv) @@ -141,6 +144,7 @@ int option_index = 0, c; static struct option long_options[] = { {"help", 0, 0, 'h'}, + {"oneshot", 0, 0, 'o'}, {"config-file", 1, 0, 'c'}, {"debug", 1, 0, 'd'}, {"daemonize", 0, 0, 'D'}, @@ -151,7 +155,7 @@ {0, 0, 0, 0} }; - c = getopt_long(argc, argv, "hc:d:Dse:TV", + c = getopt_long(argc, argv, "hoc:d:Dse:TV", long_options, &option_index); if (c == -1) break; @@ -161,6 +165,9 @@ print_usage(); print_help(); exit(0); + case 'o': + cmdline_opts.oneshot = true; + break; case 'c': cmdline_opts.config_file = optarg; break; @@ -212,6 +219,9 @@ display_update(root); value_node_del(root); + if (cmdline_opts.oneshot) + exit(0); + osmo_timer_schedule(&print_timer, 1, 0); } -- To view, visit https://gerrit.osmocom.org/c/osmo-sysmon/+/16002 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sysmon Gerrit-Branch: master Gerrit-Change-Id: Id920c4afee633b8da6919b7b318f9c868890a176 Gerrit-Change-Number: 16002 Gerrit-PatchSet: 2 Gerrit-Owner: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191112/8e30304e/attachment.htm>