_describe 'slices' _slices
}
+(( $+functions[_systemd-run_job_modes] )) ||
+ _systemd-run_job_modes() {
+ local -a _modes
+ _modes=($( systemd-run --job-mode=help 2>/dev/null ))
+ _values "${_modes[@]}"
+ }
+
_arguments \
'(-G --collect)'{-G,--collect}'[Unload the transient unit after it completed]' \
'--description=[Description for unit]:description' \
'(-t --pty)'{-t,--pty}'[The service connects to the terminal]' \
'(-q --quiet)'{-q,--quiet}'[Suppresses additional informational output]' \
'--json=[Output as JSON]:JSON:(pretty short off)' \
+ '--job-mode=[Specify how to deal with other jobs]:mode:_systemd-run_job_modes' \
'(-r --remain-after-exit)'{-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \
'(-d --same-dir)'{-d,--same-dir}'[Run on the current working directory]' \
'--scope[Run this as scope rather than service]' \
#include "ptyfwd.h"
#include "signal-util.h"
#include "special.h"
+#include "string-table.h"
#include "strv.h"
#include "terminal-util.h"
#include "uid-classification.h"
static bool arg_aggressive_gc = false;
static char *arg_working_directory = NULL;
static bool arg_shell = false;
+static JobMode arg_job_mode = JOB_FAIL;
static char **arg_cmdline = NULL;
static char *arg_exec_path = NULL;
static bool arg_ignore_failure = false;
" --json=pretty|short|off Print unit name and invocation id as JSON\n"
" -G --collect Unload unit after it ran, even when failed\n"
" -S --shell Invoke a $SHELL interactively\n"
+ " --job-mode=MODE Specify how to deal with already queued jobs,\n"
+ " when queueing a new job\n"
" --ignore-failure Ignore the exit status of the invoked process\n"
" --background=COLOR Set ANSI color for background\n"
"\n%3$sPath options:%4$s\n"
ARG_WAIT,
ARG_WORKING_DIRECTORY,
ARG_SHELL,
+ ARG_JOB_MODE,
ARG_IGNORE_FAILURE,
ARG_BACKGROUND,
ARG_JSON,
{ "working-directory", required_argument, NULL, ARG_WORKING_DIRECTORY },
{ "same-dir", no_argument, NULL, 'd' },
{ "shell", no_argument, NULL, 'S' },
+ { "job-mode", required_argument, NULL, ARG_JOB_MODE },
{ "ignore-failure", no_argument, NULL, ARG_IGNORE_FAILURE },
{ "background", required_argument, NULL, ARG_BACKGROUND },
{ "json", required_argument, NULL, ARG_JSON },
arg_shell = true;
break;
+ case ARG_JOB_MODE:
+ if (streq(optarg, "help"))
+ return DUMP_STRING_TABLE(job_mode, JobMode, _JOB_MODE_MAX);
+
+ r = job_mode_from_string(optarg);
+ if (r < 0)
+ return log_error_errno(r, "Invalid job mode: %s", optarg);
+
+ arg_job_mode = r;
+ break;
+
case ARG_IGNORE_FAILURE:
arg_ignore_failure = true;
break;
return bus_log_create_error(r);
/* Name and mode */
- r = sd_bus_message_append(m, "ss", service, "fail");
+ r = sd_bus_message_append(m, "ss", service, job_mode_to_string(arg_job_mode));
if (r < 0)
return bus_log_create_error(r);
return bus_log_create_error(r);
/* Name and Mode */
- r = sd_bus_message_append(m, "ss", scope, "fail");
+ r = sd_bus_message_append(m, "ss", scope, job_mode_to_string(arg_job_mode));
if (r < 0)
return bus_log_create_error(r);
return bus_log_create_error(r);
/* Name and Mode */
- r = sd_bus_message_append(m, "ss", trigger, "fail");
+ r = sd_bus_message_append(m, "ss", trigger, job_mode_to_string(arg_job_mode));
if (r < 0)
return bus_log_create_error(r);