]> git.ipfire.org Git - thirdparty/systemd.git/commit - man/systemd.service.xml
service: add new RestartMode option
authorRichard Phibel <rphibel@googlemail.com>
Thu, 6 Jul 2023 12:33:52 +0000 (14:33 +0200)
committerRichard Phibel <rphibel@googlemail.com>
Thu, 6 Jul 2023 12:33:52 +0000 (14:33 +0200)
commite568fea9fcd2189d4366df254a8a4031dc433762
tree19ca4fa497560b5516319dba14cef427cb841f8d
parent5bc9ea070f7734a9b86c6f7f8e2ed4365229a6c1
service: add new RestartMode option

When this option is set to direct, the service restarts without entering a failed
state. Dependent units are not notified of transitory failure.

This is useful for the following use case:

We have a target with Requires=my-service, After=my-service.
my-service.service is a oneshot service and has Restart=on-failure in
its definition.

my-service.service can get stuck for various reasons and time out, in
which case it is restarted. Currently, when it fails the first time, the
target fails, even though my-service is restarted.

The behavior we're looking for is that until my-service is not restarted
anymore, the target stays pending waiting for my-service.service to
start successfully or fail without being restarted anymore.
20 files changed:
man/org.freedesktop.systemd1.xml
man/systemd.service.xml
src/core/dbus-service.c
src/core/load-fragment-gperf.gperf.in
src/core/load-fragment.c
src/core/load-fragment.h
src/core/service.c
src/core/service.h
src/shared/bus-unit-util.c
src/test/test-tables.c
test/testsuite-03.units/fails-on-restart-restartdirect.service [new file with mode: 0644]
test/testsuite-03.units/fails-on-restart-restartdirect.target [new file with mode: 0755]
test/testsuite-03.units/fails-on-restart.service [new file with mode: 0644]
test/testsuite-03.units/fails-on-restart.target [new file with mode: 0755]
test/testsuite-03.units/succeeds-on-restart-restartdirect.service [new file with mode: 0755]
test/testsuite-03.units/succeeds-on-restart-restartdirect.target [new file with mode: 0755]
test/testsuite-03.units/succeeds-on-restart.service [new file with mode: 0755]
test/testsuite-03.units/succeeds-on-restart.sh [new file with mode: 0755]
test/testsuite-03.units/succeeds-on-restart.target [new file with mode: 0755]
test/units/testsuite-03.sh