Repository navigation
feat(linbo-remote): append a JSON record per finished run - #184
Conversation
Nothing persisted that a -c run had happened once its tmux session was gone, so consumers (linuxmuster-api, webui) could not list finished runs. The remote script now installs an EXIT trap that appends one JSON line to LINBOLOGDIR/linbo-remote_runs.jsonl with hostname, mode, commands, dry_run, start, end, rc and the path of the run's log (see the per-run logfile). The static part is built by buildRunRecordPrefix(); only the script knows the end time and exit status, so it completes the line. A trap also covers aborted runs, and the append is serialized with flock because parallel runs share the file. Part 2 of #179. Onboot (-p) runs are not recorded: the server only queues them, end time and status are unknown to it. Signed-off-by: thomas@linuxmuster.net Assisted-by: Claude
After an unhandled fatal signal bash reports $?=0 inside the EXIT trap, so a run whose tmux session was killed was recorded with "rc":0, i.e. as a success. Found while testing the run record live. Turn HUP/INT/TERM into `exit 129/130/143` before the EXIT trap fires, so the record carries the 128+signal status. The record of an aborted run appears once the in-flight linbo-ssh child has finished. Refs #179 Signed-off-by: thomas@linuxmuster.net Assisted-by: Claude
f9c8868 to
5b325b2
Compare
352dbcc to
6f13ee0
Compare
|
Thanks for this. A review of the code, with the points a consumer (linuxmuster-api, webui7, edulution) runs into: Line references are to the files on the PR branches ( 1. 2. A run that is still in progress, or ended by SIGKILL/OOM/server reboot, leaves no record at all ( 3. No field links the per-host lines of one invocation, and skipped hosts leave no trace. 4. 5. Schema is undocumented beyond the field names. Add a |
Part 2 of #179. Stacked on #183 (base is that branch; retarget to
mainonce #183 is merged).Every
-crun appends one JSON line to$LINBOLOGDIR/linbo-remote_runs.jsonl:{"hostname":"r100-pc01","mode":"direct","commands":["sync:1"],"dry_run":false,"start":"2026-10-01T11:36:43+0200","log":"/var/log/linuxmuster/linbo/r100-pc01_linbo-remote_20261001113643.log","end":"2026-10-01T11:41:02+0200","rc":0}EXITtrap, since only it knows end time and exit status. A trap also leaves a record for aborted runs (e.g. killed tmux session).flock(parallel hosts share the file).linbo-sshreplaced bytrue/false) and check the record on success and failure.Not covered: onboot (
-p) runs. The server only queues them and never learns end time or status, so there is nothing to record on its side. Say if you want a "queued" record for those too.Refs #179
🤖 Generated with Claude Code