diff --git a/scripts/crontab/task/crontab_task_processor.sh b/scripts/crontab/task/crontab_task_processor.sh index 2a6522a..d93f598 100755 --- a/scripts/crontab/task/crontab_task_processor.sh +++ b/scripts/crontab/task/crontab_task_processor.sh @@ -81,8 +81,17 @@ updateTaskFields() { jqExpr="$jqExpr | .$key = \$$key" done + # The processor runs as the manager user, which CANNOT create files in the + # docker-install-owned TASK_DIR. A plain `jq … > "$tmp"` redirect therefore + # failed silently, so neither `status: running` nor `status: completed` was + # ever written and the task was reprocessed forever. Capture jq's output and + # write the temp via runFileWrite (the privileged helper, like writeAtomic), + # then chmod + atomic mv as before. + local updated + updated=$(jq "${jqArgs[@]}" "$jqExpr" "$taskFile" 2>/dev/null) || return 1 + [[ -z "$updated" ]] && return 1 local tmp="${taskFile}.tmp.$$" - jq "${jqArgs[@]}" "$jqExpr" "$taskFile" 2>/dev/null > "$tmp" \ + printf '%s' "$updated" | runFileWrite "$tmp" \ && runFileOp chmod 644 "$tmp" 2>/dev/null \ && runFileOp mv "$tmp" "$taskFile" }