run: add --job-mode= argument (#34708)
systemctl has a --job-mode= argument, and adding the same argument to systemd-run is useful for starting transient scopes with dependencies. For example, if a transient scope BindsTo a service that is stopping, specifying --job-mode=replace will wait for the service to stop before starting it again, while the default job mode of "fail" will cause the systemd-run invocation to fail.
This commit is contained in:
@@ -344,6 +344,20 @@ static const char* const notify_access_table[_NOTIFY_ACCESS_MAX] = {
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(notify_access, NotifyAccess);
|
||||
|
||||
static const char* const job_mode_table[_JOB_MODE_MAX] = {
|
||||
[JOB_FAIL] = "fail",
|
||||
[JOB_REPLACE] = "replace",
|
||||
[JOB_REPLACE_IRREVERSIBLY] = "replace-irreversibly",
|
||||
[JOB_ISOLATE] = "isolate",
|
||||
[JOB_FLUSH] = "flush",
|
||||
[JOB_IGNORE_DEPENDENCIES] = "ignore-dependencies",
|
||||
[JOB_IGNORE_REQUIREMENTS] = "ignore-requirements",
|
||||
[JOB_TRIGGERING] = "triggering",
|
||||
[JOB_RESTART_DEPENDENCIES] = "restart-dependencies",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(job_mode, JobMode);
|
||||
|
||||
SpecialGlyph unit_active_state_to_glyph(UnitActiveState state) {
|
||||
static const SpecialGlyph map[_UNIT_ACTIVE_STATE_MAX] = {
|
||||
[UNIT_ACTIVE] = SPECIAL_GLYPH_BLACK_CIRCLE,
|
||||
|
||||
@@ -283,6 +283,20 @@ typedef enum NotifyAccess {
|
||||
_NOTIFY_ACCESS_INVALID = -EINVAL,
|
||||
} NotifyAccess;
|
||||
|
||||
typedef enum JobMode {
|
||||
JOB_FAIL, /* Fail if a conflicting job is already queued */
|
||||
JOB_REPLACE, /* Replace an existing conflicting job */
|
||||
JOB_REPLACE_IRREVERSIBLY,/* Like JOB_REPLACE + produce irreversible jobs */
|
||||
JOB_ISOLATE, /* Start a unit, and stop all others */
|
||||
JOB_FLUSH, /* Flush out all other queued jobs when queueing this one */
|
||||
JOB_IGNORE_DEPENDENCIES, /* Ignore both requirement and ordering dependencies */
|
||||
JOB_IGNORE_REQUIREMENTS, /* Ignore requirement dependencies */
|
||||
JOB_TRIGGERING, /* Adds TRIGGERED_BY dependencies to the same transaction */
|
||||
JOB_RESTART_DEPENDENCIES,/* A "start" job for the specified unit becomes "restart" for depending units */
|
||||
_JOB_MODE_MAX,
|
||||
_JOB_MODE_INVALID = -EINVAL,
|
||||
} JobMode;
|
||||
|
||||
char* unit_dbus_path_from_name(const char *name);
|
||||
int unit_name_from_dbus_path(const char *path, char **name);
|
||||
|
||||
@@ -346,4 +360,7 @@ UnitDependency unit_dependency_from_string(const char *s) _pure_;
|
||||
const char* notify_access_to_string(NotifyAccess i) _const_;
|
||||
NotifyAccess notify_access_from_string(const char *s) _pure_;
|
||||
|
||||
const char* job_mode_to_string(JobMode t) _const_;
|
||||
JobMode job_mode_from_string(const char *s) _pure_;
|
||||
|
||||
SpecialGlyph unit_active_state_to_glyph(UnitActiveState state);
|
||||
|
||||
Reference in New Issue
Block a user