From 20c1b75d43ab21fd12ecde003182a07facce48e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 12:55:42 +0000 Subject: [PATCH 2/3] Fix infinite restart loop: break on clean exit, cap crashes at 10 Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- .templates/ha_entrypoint.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.templates/ha_entrypoint.sh b/.templates/ha_entrypoint.sh index cbb60af9f..fd49e9dbb 100755 --- a/.templates/ha_entrypoint.sh +++ b/.templates/ha_entrypoint.sh @@ -201,10 +201,20 @@ if $PID1; then chmod +x "$runfile" ( restart_count=0 + max_restarts=10 while true; do - "$runfile" || true + "$runfile" + rc=$? + if [ "$rc" -eq 0 ]; then + echo "$runfile exited cleanly (exit 0), not restarting." + break + fi restart_count=$((restart_count + 1)) - echo -e "\e[38;5;214m$(date) WARNING: $runfile exited, restarting (#${restart_count}) in 5s...\e[0m" + if [ "$restart_count" -ge "$max_restarts" ]; then + echo -e "\033[0;31mERROR: $runfile has crashed $restart_count times (last exit code: $rc), giving up.\033[0m" + break + fi + echo -e "\e[38;5;214m$(date) WARNING: $runfile exited (code $rc), restarting (#${restart_count}/${max_restarts}) in 5s...\e[0m" sleep 5 done ) & From 7134bd92d743557a176c48bdd7c0f46a21eae058 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Mon, 23 Feb 2026 13:59:40 +0100 Subject: [PATCH 3/3] Reduce max restarts from 10 to 5 --- .templates/ha_entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.templates/ha_entrypoint.sh b/.templates/ha_entrypoint.sh index fd49e9dbb..dad64da45 100755 --- a/.templates/ha_entrypoint.sh +++ b/.templates/ha_entrypoint.sh @@ -201,7 +201,7 @@ if $PID1; then chmod +x "$runfile" ( restart_count=0 - max_restarts=10 + max_restarts=5 while true; do "$runfile" rc=$?