initctl: add the settings of a service to the JSON status

initctl -j status had the state of a service but little of how it is
set up.  A program reading it could not tell how the service is
stopped, what scripts it runs, or how it signals readiness.

Add the settings: stop, reload, notify, remain, scripts, directories,
cgroup-config, rlimits, log or tty, provides, conflicts, if, groups,
capabilities, pam, name, id, protected, and nowarn.  The restart
object also gets sec, respawn, and oncrash, and the state Finit keeps
for its own use goes in internal:

    "stop": {
      "signal": "SIGTERM",
      "timeout": 3,
      "scope": "pgroup"
    },
    "scripts": {
      "exec-stop-post": { "command": "/bin/true", "timeout": 7 }
    },

initctl reads the status over D-Bus first, so each setting is also a
property of org.finit.Service1.  The new test checks that the JSON is
the same over D-Bus as over the initctl socket.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-19 21:51:23 +01:00
1 parent 9fa50746a7
commit c94fd9c495
12 files changed
+893 -29

No files matched your search

+6 -1
View File
@@ -18,7 +18,12 @@ All relevant changes are documented in this file.
service. New is a `restart` object with the restart counter,
`restart-max`, the current restart delay and its limit, and `manual`
and `started`. `starts` is now there for all services, not only those
with `manual-start`
with `manual-start`. Also new are the settings of the service: `stop`,
`reload`, `notify`, `remain`, `scripts`, `directories`, `log` or `tty`,
`cgroup-config`, `rlimits`, `provides`, `conflicts`, `if`, `groups`,
`capabilities`, `pam`, `name`, `id`, `protected`, `nowarn`, and the
state Finit keeps for its own use in `internal`, see
[Commands & Status](initctl.md), with a D-Bus property for each
- 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