Fix service supervision and local variable scoping in ha_entrypoint.sh

Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-22 19:57:19 +00:00
parent 8043837ba4
commit 16d7fbcdf9

View File

@@ -199,8 +199,15 @@ if $PID1; then
echo "Starting: $runfile"
sed -i "1s|^.*|#!$shebang|" "$runfile"
chmod +x "$runfile"
(exec "$runfile") &
true
(
restart_count=0
while true; do
"$runfile" || true
restart_count=$((restart_count + 1))
echo -e "\e[38;5;214m$(date) WARNING: $runfile exited, restarting (#${restart_count}) in 5s...\e[0m"
sleep 5
done
) &
done
shopt -u nullglob
fi
@@ -214,6 +221,7 @@ if $PID1; then
echo -e "\033[0;32mEverything started!\033[0m"
terminate() {
local local_pid
echo "Termination signal received, forwarding to subprocesses..."
if command -v pgrep >/dev/null 2>&1; then
while read -r pid; do