From 351b4dd123f89f7f8491239b2d3f77bef5d00797 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 19 Feb 2026 16:32:49 +0000 Subject: [PATCH] systemctl: allow --marker with start/stop too --- man/systemctl.xml | 8 ++++---- src/systemctl/systemctl-main.c | 4 ++-- src/systemctl/systemctl.c | 11 +++++------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/man/systemctl.xml b/man/systemctl.xml index 63454505dc..619805891c 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -2855,10 +2855,10 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err - Only allowed with reload-or-restart. Enqueues restart jobs for all - units that have the needs-restart mark, and reload jobs for units that have the - needs-reload mark. When a unit marked for reload does not support reload, restart - will be queued. Those properties can be set using set-property Markers=…. + Only allowed with reload-or-restart, start, or + stop. Enqueues jobs for all units that are marked. When a unit marked for reload + does not support reload, restart will be queued. Those properties can be set using + set-property Markers=…. Unless is used, systemctl will wait for the queued jobs to finish. diff --git a/src/systemctl/systemctl-main.c b/src/systemctl/systemctl-main.c index c0596cfb86..b23bc4e6ff 100644 --- a/src/systemctl/systemctl-main.c +++ b/src/systemctl/systemctl-main.c @@ -59,8 +59,8 @@ static int systemctl_main(int argc, char *argv[]) { { "list-machines", VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_list_machines }, { "clear-jobs", VERB_ANY, 1, VERB_ONLINE_ONLY, verb_trivial_method }, { "cancel", VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_cancel }, - { "start", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start }, - { "stop", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start }, + { "start", VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_start }, + { "stop", VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_start }, { "condstop", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start }, /* For compatibility with ALTLinux */ { "reload", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start }, { "restart", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start }, diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 382a50e312..fef1cb7a77 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -1069,14 +1069,13 @@ static int systemctl_parse_argv(int argc, char *argv[]) { return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--wait may not be combined with --no-block."); - bool do_reload_or_restart = streq_ptr(argv[optind], "reload-or-restart"); if (arg_marked) { - if (!do_reload_or_restart) + if (!STRPTR_IN_SET(argv[optind], "reload-or-restart", "start", "stop")) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "--marked may only be used with 'reload-or-restart'."); + "--marked may only be used with 'reload-or-restart', 'start', or 'stop'."); if (optind + 1 < argc) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "No additional arguments allowed with 'reload-or-restart --marked'."); + "No additional arguments allowed with '%s --marked'.", strna(argv[optind])); if (arg_wait) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--marked --wait is not supported."); @@ -1084,10 +1083,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) { return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--marked --show-transaction is not supported."); - } else if (do_reload_or_restart) { + } else if (STRPTR_IN_SET(argv[optind], "reload-or-restart", "start", "stop")) { if (optind + 1 >= argc) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "List of units to restart/reload is required."); + "List of units to %s is required.", strna(argv[optind])); } if (arg_image && arg_root)