initctl: add what was missing from the JSON status

initctl -j status is for other programs and should have all there is,
the plain view is the one kept short.  It was the other way around:
the restart counter and restart-max were only in the plain view, and
the restart delay of restart-max-sec was not in the JSON either.

Add a restart object:

    "restarts": 7,
    "restart": {
      "count": 4,
      "max": -1,
      "delay": 160,
      "limit": 300
    },

Also add manual and started, and give starts for all services, not
only those with manual-start.  The restarts total stays where it is.

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 308287923d
commit 9fa50746a7
4 files changed
+74 -5

No files matched your search

+2
View File
@@ -77,6 +77,8 @@ assert_delay 4 5 4 5
say 'The restart counter stops where the delay peaks'
assert "Delay and limit in status" "$(texec initctl status crash | sed -n 's/.*Restart in : //p')" = "4 sec (max 4)"
run "initctl -j status crash"
assert "Same in JSON" "$(texec initctl -j status crash | jq -c .restart)" = '{"count":2,"max":-1,"delay":4,"limit":4}'
assert "Restart counter is 2" "$(texec initctl status crash | awk '/Restarts/{ print $4 }')" = "(2/-1)"
sep