diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-10-14 19:59:47 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-10-27 20:02:47 +0100 |
commit | 7a13937007ccc7246b8351c7d31d17252b9940a0 (patch) | |
tree | 140fab7973aadf38b84bffaeaac66439627897df /man/systemd.service.xml | |
parent | core: make refuse_late_merge a proper attr of Job and introduce TRANSACTION_R... (diff) | |
download | systemd-7a13937007ccc7246b8351c7d31d17252b9940a0.tar.xz systemd-7a13937007ccc7246b8351c7d31d17252b9940a0.zip |
core/service: don't propagate stop jobs if RestartMode=direct
The goal of RestartMode=direct is to make restarts invisible
to dependents, so auto restart jobs shouldn't bring them down
at all. So far we only skipped going through failed/dead states
in service_enter_dead(), i.e. the unit would never be considered
dead. But when constructing restart transaction, the stop job
would be propagated to dependents. Consider the following 2 units:
dependent.target:
[Unit]
BindsTo=a.service
After=a.service
a.service:
[Service]
ExecStart=bash -c 'sleep 100 && exit 1'
Restart=on-failure
RestartMode=direct
Before this commit, even though BindsTo= isn't triggered since
a.service never failed, when a.service auto-restarts, dependent.target
is also restarted. Let's suppress it by using JOB_REPLACE instead of
JOB_RESTART_DEPENDENCIES in service_enter_restart().
Fixes #34758
The example above is subtly different from the original report,
to illustrate that the new behavior makes sense for less exotic
use cases too.
Diffstat (limited to 'man/systemd.service.xml')
-rw-r--r-- | man/systemd.service.xml | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/man/systemd.service.xml b/man/systemd.service.xml index 3066c91955..a5c0dc84e1 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -942,7 +942,7 @@ <listitem> <para>If set to <option>direct</option>, the service transitions to the activating state directly during auto-restart, skipping failed/inactive state. - <varname>ExecStopPost=</varname> is invoked. + <varname>ExecStopPost=</varname> is still invoked. <varname>OnSuccess=</varname> and <varname>OnFailure=</varname> are skipped.</para> <para>This option is useful in cases where a dependency can fail temporarily but we don't |