initctl: show the restart delay of a service with restart-max-sec

With restart-max-sec the delay before the next restart varies, and
nothing showed what it was or how far it could grow.

Show both in initctl status, for a service that has the setting:

       Restarts : 7 (4/-1)
     Restart in : 160 sec (max 300)

Add the D-Bus properties RestartDelay and RestartDelayMax for it, so
the status is the same when initctl goes over D-Bus.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-19 20:39:43 +01:00
1 parent 7f652770e3
commit 308287923d
6 files changed
+30 -2

No files matched your search

+3 -1
View File
@@ -17,7 +17,9 @@ All relevant changes are documented in this file.
- Add `restart-max-sec`, a limit for the delay between restarts of a
crashing service. When set, the delay doubles for each restart, from
`restart-sec` up to the limit, and comes down again as the service keeps
running. Issue #306
running. `initctl status` shows the current delay and the limit, also
available as the D-Bus properties `RestartDelay` and `RestartDelayMax`.
Issue #306
- Add `stop-scope`, which processes a stop applies to: `pgroup`, the process
group of the main process (default), `process`, only the main process,
`cgroup`, the cgroup of the service, or `mixed` like systemd. Issue #413
+11 -1
View File
@@ -186,7 +186,8 @@ following settings are available:
restart is at once, then after 2, 4, 8 seconds, and so on. A service
that stays up longer than the current delay is restarted after
`restart-sec` the next time it crashes, and the delay comes down
again the longer the service keeps running. Useful with
again the longer the service keeps running. `initctl status NAME`
shows the current delay and the limit, see below. Useful with
`restart = "always"`, for a service that should be retried forever,
only less and less often
* `restart = "always"` -- no upper limit on the number of times Finit
@@ -208,6 +209,15 @@ following settings are available:
* `oncrash = "script"` -- similarly, but instead of rebooting, call
the `exec-stop-post` script with exit code `crashed`, see below
With `restart-max-sec` set, `initctl status` shows the delay before the
next restart and its limit, here for a service that has crashed four
times in a row:
$ initctl status dialer
...
Restarts : 7 (4/-1)
Restart in : 160 sec (max 300)
Service directories
-------------------
+2
View File
@@ -187,6 +187,8 @@ All read-only; observable via `Properties.Get` and `Properties.GetAll`.
| `ExitStatus` | `u` | Raw `waitpid(2)` status from the last exit |
| `RestartsTotal` | `u` | Restarts over the service's lifetime |
| `RestartMax` | `u` | Restart limit before the service is blocked |
| `RestartDelay` | `u` | Seconds before the next restart, should the service crash |
| `RestartDelayMax` | `u` | The `restart-max-sec` setting, 0 when not set |
| `Starts` | `u` | Times started, for `manual-start` units |
| `ManualStart` | `b` | `manual-start` set in the `.conf` |
| `Forking` | `b` | Daemon forks to background |