Fix set -e abort: ((i++)) at i=0 returns 1; use i=$((i+1))
This commit is contained in:
parent
9a45e39db6
commit
90d1517f10
1 changed files with 4 additions and 4 deletions
|
|
@ -483,7 +483,7 @@ wait_healthy() {
|
||||||
local id=$1 url=$2 max=${3:-40}
|
local id=$1 url=$2 max=${3:-40}
|
||||||
local i=0
|
local i=0
|
||||||
while ! pct exec "$id" -- curl -sf --max-time 2 "$url" &>/dev/null; do
|
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
|
[[ $i -ge $max ]] && return 1
|
||||||
done
|
done
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -493,7 +493,7 @@ wait_pg() {
|
||||||
local max=30 i=0
|
local max=30 i=0
|
||||||
while ! pct exec 100 -- bash -c \
|
while ! pct exec 100 -- bash -c \
|
||||||
"docker exec hotel-manage-postgres pg_isready -U postgres" &>/dev/null; do
|
"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; }
|
[[ $i -ge $max ]] && { msg_warn "Postgres not ready after 90s"; return 1; }
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
@ -685,7 +685,7 @@ EOF
|
||||||
# NPM admin API on port 81 — wait up to 60s
|
# NPM admin API on port 81 — wait up to 60s
|
||||||
local i=0
|
local i=0
|
||||||
while ! pct exec 103 -- curl -sf --max-time 3 "http://localhost:81/api/" &>/dev/null; do
|
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
|
done
|
||||||
msg_ok "NPM running — admin UI at http://${NPM_LAN_IP}:81"
|
msg_ok "NPM running — admin UI at http://${NPM_LAN_IP}:81"
|
||||||
msg_warn "NPM default login: admin@example.com / changeme (change immediately!)"
|
msg_warn "NPM default login: admin@example.com / changeme (change immediately!)"
|
||||||
|
|
@ -774,7 +774,7 @@ configure_npm_proxy_hosts() {
|
||||||
|
|
||||||
local i=0
|
local i=0
|
||||||
while ! curl -sf --max-time 3 "http://${NPM_LAN_IP}:81/api/" &>/dev/null; do
|
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; }
|
[[ $i -ge 30 ]] && { msg_warn "NPM API not responding — configure proxy hosts manually"; return; }
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue