Fix redeploy script reporting failure on a successful restart
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.
This commit is contained in:
@@ -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)"
|
||||
|
||||
Reference in New Issue
Block a user