From 5fe02b7c985691724349827d46927edd979b8ba6 Mon Sep 17 00:00:00 2001 From: Dai Ha Date: Sat, 15 Aug 2026 15:18:44 +0200 Subject: [PATCH] Fix redeploy script reporting failure on a successful restart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found by running it. The script launched the daemon with a relative jar path (cwd is bridged/) but detected it with an absolute one, so pgrep never matched. The daemon restarted correctly and booted clean, and the script still failed with 'no process appeared' — the worst shape of bug for a deploy tool, because it invites a second restart on a daemon that is already healthy. Detection now matches both path forms, and the launch uses the absolute path so ps names which checkout is running. --- scripts/redeploy-bridged.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/redeploy-bridged.sh b/scripts/redeploy-bridged.sh index 854a977..69564d8 100755 --- a/scripts/redeploy-bridged.sh +++ b/scripts/redeploy-bridged.sh @@ -32,7 +32,11 @@ REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" BRIDGED="$REPO/bridged" JAR="$BRIDGED/target/bridged.jar" OUT="$BRIDGED/bridged.out" -PATTERN='bridged/target/bridged.jar' +# Matches BOTH the absolute form and the relative `java -jar target/bridged.jar` a hand-start +# produces from inside bridged/. Anchoring on the absolute path alone was a real bug: the daemon +# restarted correctly and the script still reported "no process appeared", because it launched with +# a relative path and then looked for an absolute one. +PATTERN='target/bridged.jar' HEALTH='http://127.0.0.1:8765/healthz' STOP_WAIT=30 # seconds to wait for a clean exit before reporting failure HEALTH_WAIT=60 # seconds to wait for /healthz to answer after start @@ -143,7 +147,9 @@ fi # because the daemon resolves bridged.yaml, logs/ and target/ relative to it. say "start" -( cd "$BRIDGED" && zsh -lc 'nohup java -jar target/bridged.jar >> bridged.out 2>&1 &' ) +# Absolute jar path so `ps` names which checkout is running; cwd still bridged/ because the daemon +# resolves bridged.yaml, logs/ and target/ relative to it. +( cd "$BRIDGED" && zsh -lc "nohup java -jar '$JAR' >> bridged.out 2>&1 &" ) for _ in $(seq 10); do NEW_PID="$(running_pid)"