Fix set -e abort: ((i++)) at i=0 returns 1; use i=$((i+1))

This commit is contained in:
jtricerolph 2026-07-01 14:06:40 +00:00
parent 9a45e39db6
commit 90d1517f10

View file

@ -483,7 +483,7 @@ wait_healthy() {
local id=$1 url=$2 max=${3:-40}
local i=0
while ! pct exec "$id" -- curl -sf --max-time 2 "$url" &>/dev/null; do
sleep 3; ((i++))
sleep 3; i=$((i+1))
[[ $i -ge $max ]] && return 1
done
return 0
@ -493,7 +493,7 @@ wait_pg() {
local max=30 i=0
while ! pct exec 100 -- bash -c \
"docker exec hotel-manage-postgres pg_isready -U postgres" &>/dev/null; do
sleep 3; ((i++))
sleep 3; i=$((i+1))
[[ $i -ge $max ]] && { msg_warn "Postgres not ready after 90s"; return 1; }
done
}
@ -685,7 +685,7 @@ EOF
# NPM admin API on port 81 — wait up to 60s
local i=0
while ! pct exec 103 -- curl -sf --max-time 3 "http://localhost:81/api/" &>/dev/null; do
sleep 3; ((i++)); [[ $i -ge 20 ]] && break
sleep 3; i=$((i+1)); [[ $i -ge 20 ]] && break
done
msg_ok "NPM running — admin UI at http://${NPM_LAN_IP}:81"
msg_warn "NPM default login: admin@example.com / changeme (change immediately!)"
@ -774,7 +774,7 @@ configure_npm_proxy_hosts() {
local i=0
while ! curl -sf --max-time 3 "http://${NPM_LAN_IP}:81/api/" &>/dev/null; do
sleep 3; ((i++))
sleep 3; i=$((i+1))
[[ $i -ge 30 ]] && { msg_warn "NPM API not responding — configure proxy hosts manually"; return; }
done