home-assistant-apps/cookcli/rootfs/usr/local/bin/reload-http.sh
2026-09-20 11:31:13 +02:00

11 lines
474 B
Bash

#!/usr/bin/with-contenv bashio
# Consomme la requête jusqu'à la ligne vide
while IFS= read -r line; do line="${line%$'\r'}"; [ -z "$line" ] && break; done
if /usr/local/bin/git-sync-now.sh >/dev/null 2>&1; then
status="200 OK"; body='{"status":"ok"}'
else
status="500 Internal Server Error"; body='{"status":"error"}'
fi
printf 'HTTP/1.1 %s\r\nContent-Type: application/json\r\nContent-Length: %d\r\nConnection: close\r\n\r\n%s' \
"$status" "${#body}" "$body"