Skip to content

Commit 2bba0c3

Browse files
committed
Science Commit 5.
1 parent 50cb55f commit 2bba0c3

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
32295
1+
32895

scripts/start-frontends.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,34 @@ if [ ${#MISSING[@]} -gt 0 ]; then
135135
sleep 3
136136
fi
137137

138+
# ── Force Tomcat to reload all contexts if any show 404 ──────────────────────
139+
echo ""
140+
echo " [*] Checking Tomcat webapp loading..."
141+
NEEDS_RELOAD=0
142+
for MODULE_SPEC in "${MODULES[@]}"; do
143+
IFS=':' read -r MOD_DIR CONTEXT <<< "$MODULE_SPEC"
144+
HC=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 2 "http://localhost:8080/$CONTEXT/" 2>/dev/null || echo "000")
145+
if [ "$HC" = "404" ] || [ "$HC" = "000" ]; then
146+
NEEDS_RELOAD=1
147+
break
148+
fi
149+
done
150+
151+
if [ "$NEEDS_RELOAD" -eq 1 ]; then
152+
echo " [*] Some webapps returning 404 — restarting Tomcat to force reload..."
153+
if [ -x "$TOMCAT_HOME/bin/shutdown.sh" ]; then
154+
"$TOMCAT_HOME/bin/shutdown.sh" >/dev/null 2>&1 || true
155+
sleep 3
156+
"$TOMCAT_HOME/bin/startup.sh" >/dev/null 2>&1
157+
else
158+
sudo systemctl restart tomcat 2>/dev/null || true
159+
fi
160+
echo " [*] Waiting for Tomcat to load webapps (8s)..."
161+
sleep 8
162+
else
163+
echo " [✓] All webapps loaded — no restart needed"
164+
fi
165+
138166
# ── Verify HTTP endpoints ─────────────────────────────────────────────────────
139167
echo ""
140168
echo " [*] Verifying HTTP endpoints..."

0 commit comments

Comments
 (0)