run: add --job-mode= argument
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:
@@ -38,7 +38,7 @@ _systemd_run() {
|
||||
--unit -p --property --slice --description --service-type --uid --gid --nice --working-directory
|
||||
-E --setenv --on-active --on-boot --on-startup --on-unit-active --on-unit-inactive --on-calendar
|
||||
--path-property --socket-property --timer-property -H --host -M --machine --expand-environment
|
||||
--background --json
|
||||
--background --json --job-mode
|
||||
)
|
||||
local OPTS="${opts_with_values[*]} --no-ask-password --scope -u --slice-inherit -r --remain-after-exit
|
||||
--send-sighup -d --same-dir -t --pty -P --pipe -S --shell -q --quiet --ignore-failure
|
||||
@@ -131,6 +131,11 @@ _systemd_run() {
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
--job-mode)
|
||||
local comps=$( systemd-run --job-mode=help 2>/dev/null )
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||
|
||||
Reference in New Issue
Block a user