diff options
author | Malfurious <m@lfurio.us> | 2023-11-09 20:17:25 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2023-11-15 23:11:08 -0500 |
commit | 29ebd30ecc38bc700a89fc5af58b60637ad3ab3a (patch) | |
tree | fb4bf2f44a9ecb507e6d6bf5abf02e6cf5435387 /dmt | |
parent | bc9a915a2709fe7c50f826183ce4d2f6b1816052 (diff) | |
download | cychedelic-29ebd30ecc38bc700a89fc5af58b60637ad3ab3a.tar.gz cychedelic-29ebd30ecc38bc700a89fc5af58b60637ad3ab3a.zip |
dmt: Implement API endpoint /api/log/{jobnum}
This returns a plain-text response (not JSON) of the full log file for
the requested job number. If `jobnum` is omited, the log of the latest
job is returned.
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'dmt')
-rwxr-xr-x | dmt/dmt | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -65,4 +65,14 @@ api_job() { fi } -api_job +api_log() { + [ -z "$1" ] && job="$(newest_job)" || job="$1" + jobdir="$CYCHE_LOG_DIR/$job" + + if [ -d "$jobdir" ]; then + printf 'Content-type: text/plain\n\n' + cat "$jobdir/log" + fi +} + +api_log |