diff --git a/man/systemctl.xml b/man/systemctl.xml
index 63454505dcb..e771275ac0f 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -499,6 +499,20 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
do not document that. -->
+
+
+ enqueue-marked-jobs
+
+ Enqueue start/stop/restart/reload jobs for all units that have the respective
+ needs-* markers set. 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.
+
+
+
+
reload-or-restart PATTERN…
diff --git a/src/systemctl/systemctl-main.c b/src/systemctl/systemctl-main.c
index c0596cfb861..3b8a5e9088e 100644
--- a/src/systemctl/systemctl-main.c
+++ b/src/systemctl/systemctl-main.c
@@ -65,6 +65,7 @@ static int systemctl_main(int argc, char *argv[]) {
{ "reload", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start },
{ "restart", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start },
{ "try-restart", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start },
+ { "enqueue-marked-jobs", 1, 1, VERB_ONLINE_ONLY, verb_start },
{ "reload-or-restart", VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_start },
{ "reload-or-try-restart", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start }, /* For compatibility with old systemctl <= 228 */
{ "try-reload-or-restart", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_start },
diff --git a/src/systemctl/systemctl-start-unit.c b/src/systemctl/systemctl-start-unit.c
index a6fb12d1c00..2e203c65ecb 100644
--- a/src/systemctl/systemctl-start-unit.c
+++ b/src/systemctl/systemctl-start-unit.c
@@ -295,6 +295,7 @@ int verb_start(int argc, char *argv[], void *userdata) {
const char *method, *job_type, *mode, *one_name, *suffix = NULL;
_cleanup_free_ char **stopped_units = NULL; /* Do not use _cleanup_strv_free_ */
_cleanup_strv_free_ char **names = NULL;
+ bool is_enqueue_marked_jobs = false;
int r, ret = EXIT_SUCCESS;
sd_bus *bus;
@@ -331,13 +332,27 @@ int verb_start(int argc, char *argv[], void *userdata) {
job_type = "start";
mode = "isolate";
suffix = ".target";
- } else if (!arg_marked) {
+ } else if (streq(argv[0], "enqueue-marked-jobs") || arg_marked) {
+ is_enqueue_marked_jobs = true;
+ method = job_type = mode = NULL;
+
+ if (arg_wait)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "--wait is not supported for enqueue-marked-jobs.");
+
+ if (arg_show_transaction)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "--show-transaction is not supported for enqueue-marked-jobs.");
+
+ if (arg_marked)
+ log_warning("--marked is deprecated. Please use systemctl enqueue-marked-jobs instead.");
+
+ } else {
/* A command in style of "systemctl start …", "systemctl stop …" and so on */
method = verb_to_method(argv[0]);
job_type = verb_to_job_type(argv[0]);
mode = arg_job_mode();
- } else
- method = job_type = mode = NULL;
+ }
one_name = NULL;
}
@@ -357,7 +372,7 @@ int verb_start(int argc, char *argv[], void *userdata) {
names = strv_new(one_name);
if (!names)
return log_oom();
- } else if (!arg_marked) {
+ } else if (!is_enqueue_marked_jobs) {
bool expanded;
r = expand_unit_names(bus, strv_skip(argv, 1), suffix, &names, &expanded);
@@ -387,7 +402,7 @@ int verb_start(int argc, char *argv[], void *userdata) {
}
_cleanup_(fork_notify_terminate) PidRef journal_pid = PIDREF_NULL;
- if (arg_marked)
+ if (is_enqueue_marked_jobs)
ret = enqueue_marked_jobs(bus, w);
else {
if (arg_verbose)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 382a50e3123..0c9dd3b0afb 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -143,6 +143,7 @@ static int systemctl_help(void) {
" reload UNIT... Reload one or more units\n"
" restart UNIT... Start or restart one or more units\n"
" try-restart UNIT... Restart one or more units if active\n"
+ " enqueue-marked-jobs Enqueue all marked unit jobs\n"
" reload-or-restart UNIT... Reload one or more units if possible,\n"
" otherwise start or restart\n"
" try-reload-or-restart UNIT... If active, reload one or more units,\n"
@@ -1077,12 +1078,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
if (optind + 1 < argc)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"No additional arguments allowed with 'reload-or-restart --marked'.");
- if (arg_wait)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "--marked --wait is not supported.");
- if (arg_show_transaction)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "--marked --show-transaction is not supported.");
} else if (do_reload_or_restart) {
if (optind + 1 >= argc)