mirror of
https://github.com/troglobit/finit.git
synced 2026-11-20 19:41:51 +00:00
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:
4 files changed
+74
-5
No files matched your search
@@ -14,6 +14,11 @@ All relevant changes are documented in this file.
|
||||
- The `restart_sec:` option of the line-based format is now spelled
|
||||
`restart-sec:`, kebab-case like every other setting. The old spelling
|
||||
is still accepted
|
||||
- `initctl -j status` now has all `initctl` gets from Finit about a
|
||||
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`
|
||||
- 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
|
||||
|
||||
@@ -146,6 +146,53 @@ Apr 8 15:02:11 alpine authpriv.info dropbear[2634]: Child connection from 192.1
|
||||
Apr 8 15:02:12 alpine authpriv.notice dropbear[2634]: Password auth succeeded for 'root' from 192.168.121.1:48576
|
||||
```
|
||||
|
||||
With `-j` the same command gives JSON, for scripts and other programs.
|
||||
The view above is kept short for reading, the JSON has everything
|
||||
`initctl` gets from Finit about the service:
|
||||
|
||||
```
|
||||
alpine:~# initctl -j status dialer
|
||||
{
|
||||
"identity": "dialer",
|
||||
"description": "Modem dialer",
|
||||
"type": "service",
|
||||
"forking": false,
|
||||
"status": "restart",
|
||||
"exit": { "code": 1 },
|
||||
"origin": "/etc/finit.d/enabled/dialer.conf",
|
||||
"command": "dialer",
|
||||
"manual": false,
|
||||
"started": false,
|
||||
"starts": 0,
|
||||
"restarts": 7,
|
||||
"restart": {
|
||||
"count": 4,
|
||||
"max": -1,
|
||||
"delay": 160,
|
||||
"limit": 300
|
||||
},
|
||||
"pidfile": "none",
|
||||
"pid": 0,
|
||||
"user": "root",
|
||||
"group": "root",
|
||||
"uptime": 0,
|
||||
"runlevels": [ 2, 3, 4, 5 ]
|
||||
}
|
||||
```
|
||||
|
||||
In `restart`, `count` is the restart counter that `restart-max`, here
|
||||
`max`, is compared to, -1 for `restart = "always"`. The total since
|
||||
boot is in `restarts`. `delay` is the number of seconds before the
|
||||
next restart, should the service crash, and `limit` is its
|
||||
`restart-max-sec`, 0 when not set. `environment`, `condition`, `exit`,
|
||||
and the cgroup members `cgroup`, `memory`, `cpu`, and `limits` are left
|
||||
out when they do not apply.
|
||||
|
||||
```
|
||||
alpine:~# initctl -j status dialer | jq .restart.delay
|
||||
160
|
||||
```
|
||||
|
||||
|
||||
Switch Root
|
||||
-----------
|
||||
|
||||
Reference in new issue
Block a user