diff --git a/man/systemctl.xml b/man/systemctl.xml index dd9e5c571f..94a77bce0c 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -1522,7 +1522,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service Shut down and halt the system. This is mostly equivalent to - start halt.target --irreversible, but also + start halt.target --job-mode=replace-irreversibly, but also prints a wall message to all users. If combined with , shutdown of all running services is skipped, however all processes are killed and all file @@ -1538,7 +1538,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service Shut down and power-off the system. This is mostly - equivalent to start poweroff.target --irreversible, + equivalent to start poweroff.target --job-mode=replace-irreversibly, but also prints a wall message to all users. If combined with , shutdown of all running services is skipped, however all processes are killed and all file @@ -1554,7 +1554,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service Shut down and reboot the system. This is mostly - equivalent to start reboot.target --irreversible, + equivalent to start reboot.target --job-mode=replace-irreversibly, but also prints a wall message to all users. If combined with , shutdown of all running services is skipped, however all processes are killed and all file @@ -1581,7 +1581,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service Shut down and reboot the system via kexec. This is - mostly equivalent to start kexec.target --irreversible, + mostly equivalent to start kexec.target --job-mode=replace-irreversibly, but also prints a wall message to all users. If combined with , shutdown of all running services is skipped, however all processes are killed and diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index 34c9444353..c2707ba3a6 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -90,10 +90,10 @@ _systemctl () { local i verb comps mode local -A OPTS=( - [STANDALONE]='--all -a --reverse --after --before --defaults --fail --ignore-dependencies --failed --force -f --full -l --global + [STANDALONE]='--all -a --reverse --after --before --defaults --failed --force -f --full -l --global --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall --quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup' - [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root' + [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root' ) if __contains_word "--user" ${COMP_WORDS[*]}; then @@ -115,6 +115,10 @@ _systemctl () { active inactive dead elapsed exited listening mounted plugged running waiting' ;; + --job-mode) + comps='fail replace replace-irreversibly isolate + ignore-dependencies ignore-requirements flush' + ;; --kill-who) comps='all control main' ;; diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index cce9dea8b5..e123d31a72 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -353,11 +353,18 @@ _unit_properties() { _values -s , "${_sys_all_properties[@]}" } +_job_modes() { + local -a _modes + _modes=(fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush) + _values -s , "${_modes[@]}" +} + _arguments -s \ {-h,--help}'[Show help]' \ '--version[Show package version]' \ {-t+,--type=}'[List only units of a particular type]:unit type:_unit_types' \ - '--state=[Display units in the specifyied state]:unit state:_unit_states' \ + '--state=[Display units in the specified state]:unit state:_unit_states' \ + '--job-mode=[Specify how to deal with other jobs]:mode:_job_modes' \ {-p+,--property=}'[Show only properties by specific name]:unit property:_unit_properties' \ {-a,--all}'[Show all units/properties, including dead/empty ones]' \ '--reverse[Show reverse dependencies]' \ @@ -365,10 +372,7 @@ _arguments -s \ '--before[Show units ordered before]' \ '--failed[Show only failed units]' \ {-l,--full}"[Don't ellipsize unit names on output]" \ - '--fail[When queueing a new job, fail if conflicting jobs are pending]' \ '--show-types[When showing sockets, show socket type]' \ - '--irreversible[Mark transactions as irreversible]' \ - '--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \ {-i,--ignore-inhibitors}'[When executing a job, ignore jobs dependencies]' \ {-q,--quiet}'[Suppress output]' \ '--no-block[Do not wait until operation finished]' \ diff --git a/test/TEST-03-JOBS/test-jobs.sh b/test/TEST-03-JOBS/test-jobs.sh index 28368b70e4..6f32c240cd 100755 --- a/test/TEST-03-JOBS/test-jobs.sh +++ b/test/TEST-03-JOBS/test-jobs.sh @@ -1,6 +1,6 @@ #!/bin/bash -x -# Test merging of a --ignore-dependencies job into a previously +# Test merging of a --job-mode=ignore-dependencies job into a previously # installed job. systemctl start --no-block hello-after-sleep.target @@ -11,7 +11,7 @@ grep 'hello\.service.*waiting' /root/list-jobs.txt || exit 1 # This is supposed to finish quickly, not wait for sleep to finish. START_SEC=$(date -u '+%s') -systemctl start --ignore-dependencies hello +systemctl start --job-mode=ignore-dependencies hello END_SEC=$(date -u '+%s') ELAPSED=$(($END_SEC-$START_SEC)) @@ -27,7 +27,7 @@ systemctl stop sleep.service hello-after-sleep.target || exit 1 systemctl start --no-block hello-after-sleep.target || exit 1 # hello.service should still be waiting, so these try-restarts will collapse # into NOPs. -systemctl try-restart --fail hello.service || exit 1 +systemctl try-restart --job-mode=fail hello.service || exit 1 systemctl try-restart hello.service || exit 1 systemctl stop hello.service sleep.service hello-after-sleep.target || exit 1 @@ -39,7 +39,7 @@ systemctl start unstoppable.service || exit 1 # This is expected to fail with 'job cancelled' systemctl stop unstoppable.service && exit 1 # But this should succeed -systemctl stop --irreversible unstoppable.service || exit 1 +systemctl stop --job-mode=replace-irreversibly unstoppable.service || exit 1 # We're going to shutdown soon. Let's see if it succeeds when # there's an active service that tries to be unstoppable. diff --git a/units/emergency.service.in b/units/emergency.service.in index 2695d7b7c9..52b9b1cd03 100644 --- a/units/emergency.service.in +++ b/units/emergency.service.in @@ -18,7 +18,7 @@ Environment=HOME=/root WorkingDirectory=/root ExecStartPre=-/bin/plymouth quit ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.' -ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default" +ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default" Type=idle StandardInput=tty-force StandardOutput=inherit diff --git a/units/rescue.service.in b/units/rescue.service.in index de73fee654..432e4f3c84 100644 --- a/units/rescue.service.in +++ b/units/rescue.service.in @@ -18,7 +18,7 @@ Environment=HOME=/root WorkingDirectory=/root ExecStartPre=-/bin/plymouth quit ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.' -ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default" +ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default" Type=idle StandardInput=tty-force StandardOutput=inherit