diff --git a/man/systemd.service.xml b/man/systemd.service.xml index d0696ba868a..094961d5c64 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -643,6 +643,43 @@ RestartMaxDelaySec=160s steps. + The total wait until the first restart at RestartMaxDelaySec= is + + + (RestartMaxDelaySec * ratio - RestartSec) / (ratio - 1) + + , or 310s in the example above. This excludes the time each start, run, and stop + takes, and any delay added by RestartRandomizedDelaySec=. + + Use systemd-analyze restart-delays to show the restart delays and their + cumulative total, and check whether the start rate limit rejects a restart. See + systemd-analyze1. + + Restarts stop when the start rate limit is hit, see + StartLimitIntervalSec= and StartLimitBurst= in + systemd.unit5. + The defaults come from DefaultStartLimitIntervalSec= and + DefaultStartLimitBurst= in + systemd-system.conf5. + With the built-in defaults of 5 starts in 10s, the example restarts indefinitely. + + The start limit example below assumes that the restart counter and start rate limit are reset + before the first start, for example by systemctl reset-failed. Earlier starts in + the current rate limit interval may cause an earlier failure. If the interval expires during the + restart sequence, the service may restart indefinitely. A successful restart does not reset the + restart counter. After starting, the service can reset the restart counter with + RESTART_RESET=1, see + sd_notify3. + + To make the unit fail once the delay reaches RestartMaxDelaySec=, set + StartLimitBurst= to RestartSteps + 1, and set + StartLimitIntervalSec= to more than the total plus the time the service takes to + start, run, and stop each time. For the example above: + + [Unit] +StartLimitIntervalSec=10min +StartLimitBurst=5 + This setting is effective only if RestartMaxDelaySec= is also set and RestartSec= is not zero.