Skip to content

Commit e631b8a

Browse files
committed
Science Commit 5.
1 parent 13976ed commit e631b8a

10 files changed

Lines changed: 141 additions & 44 deletions

File tree

modules/AE6E66/start-backend.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,21 @@ cd "$MOD_ROOT"
5252
java $JVM_OPTS -cp "$CP" "$MODULE_CLASS" >> "$LOG_DIR/backend.log" 2>&1 &
5353
PID=$!
5454
echo "$PID" > "$PID_FILE"
55-
sleep 1
5655

57-
if kill -0 "$PID" 2>/dev/null; then
58-
echo "✓ (PID $PID)"
56+
# ── Liveness callback (10s timeout — no TCP port for this module) ────────────
57+
DEADLINE=$((SECONDS + 10))
58+
ALIVE=0
59+
while [ $SECONDS -lt $DEADLINE ]; do
60+
if kill -0 "$PID" 2>/dev/null; then
61+
ALIVE=1; break
62+
fi
63+
sleep 1
64+
done
65+
66+
if [ $ALIVE -eq 1 ]; then
67+
echo "✓ (PID $PID alive)"
5968
else
60-
echo "✗ (FAILED)"
69+
echo "✗ (FAILED — exited within 10s)"
6170
rm -f "$PID_FILE"
6271
echo ""
6372
echo " Check logs: tail -f $LOG_DIR/backend.log"

modules/cia/start-backend.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ cd "$MOD_ROOT"
5252
java $JVM_OPTS -cp "$CP" "$MODULE_CLASS" >> "$LOG_DIR/backend.log" 2>&1 &
5353
PID=$!
5454
echo "$PID" > "$PID_FILE"
55-
sleep 1
5655

57-
if kill -0 "$PID" 2>/dev/null; then
58-
echo "✓ (PID $PID)"
56+
# ── Port-probe callback (10s timeout) ────────────────────────────────────────
57+
DEADLINE=$((SECONDS + 10))
58+
READY=0
59+
while [ $SECONDS -lt $DEADLINE ]; do
60+
if timeout 1 bash -c "echo >/dev/tcp/localhost/49211" 2>/dev/null; then
61+
READY=1; break
62+
fi
63+
sleep 1
64+
done
65+
66+
if [ $READY -eq 1 ]; then
67+
echo "✓ (PID $PID, port 49211 UP)"
68+
elif kill -0 "$PID" 2>/dev/null; then
69+
echo "~ (PID $PID alive, port 49211 not yet bound — timeout)"
5970
else
6071
echo "✗ (FAILED)"
6172
rm -f "$PID_FILE"

modules/duke/start-backend.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ cd "$MOD_ROOT"
5252
java $JVM_OPTS -cp "$CP" "$MODULE_CLASS" >> "$LOG_DIR/backend.log" 2>&1 &
5353
PID=$!
5454
echo "$PID" > "$PID_FILE"
55-
sleep 1
5655

57-
if kill -0 "$PID" 2>/dev/null; then
58-
echo "✓ (PID $PID)"
56+
# ── Port-probe callback (10s timeout) ────────────────────────────────────────
57+
DEADLINE=$((SECONDS + 10))
58+
READY=0
59+
while [ $SECONDS -lt $DEADLINE ]; do
60+
if timeout 1 bash -c "echo >/dev/tcp/localhost/49213" 2>/dev/null; then
61+
READY=1; break
62+
fi
63+
sleep 1
64+
done
65+
66+
if [ $READY -eq 1 ]; then
67+
echo "✓ (PID $PID, port 49213 UP)"
68+
elif kill -0 "$PID" 2>/dev/null; then
69+
echo "~ (PID $PID alive, port 49213 not yet bound — timeout)"
5970
else
6071
echo "✗ (FAILED)"
6172
rm -f "$PID_FILE"

modules/fbi/start-backend.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ cd "$MOD_ROOT"
5252
java $JVM_OPTS -cp "$CP" "$MODULE_CLASS" >> "$LOG_DIR/backend.log" 2>&1 &
5353
PID=$!
5454
echo "$PID" > "$PID_FILE"
55-
sleep 1
5655

57-
if kill -0 "$PID" 2>/dev/null; then
58-
echo "✓ (PID $PID)"
56+
# ── Port-probe callback (10s timeout) ────────────────────────────────────────
57+
DEADLINE=$((SECONDS + 10))
58+
READY=0
59+
while [ $SECONDS -lt $DEADLINE ]; do
60+
if timeout 1 bash -c "echo >/dev/tcp/localhost/49210" 2>/dev/null; then
61+
READY=1; break
62+
fi
63+
sleep 1
64+
done
65+
66+
if [ $READY -eq 1 ]; then
67+
echo "✓ (PID $PID, port 49210 UP)"
68+
elif kill -0 "$PID" 2>/dev/null; then
69+
echo "~ (PID $PID alive, port 49210 not yet bound — timeout)"
5970
else
6071
echo "✗ (FAILED)"
6172
rm -f "$PID_FILE"

modules/gray.a85/start-backend.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ cd "$MOD_ROOT"
5252
java $JVM_OPTS -cp "$CP" "$MODULE_CLASS" >> "$LOG_DIR/backend.log" 2>&1 &
5353
PID=$!
5454
echo "$PID" > "$PID_FILE"
55-
sleep 1
5655

57-
if kill -0 "$PID" 2>/dev/null; then
58-
echo "✓ (PID $PID)"
56+
# ── Port-probe callback (10s timeout) ────────────────────────────────────────
57+
DEADLINE=$((SECONDS + 10))
58+
READY=0
59+
while [ $SECONDS -lt $DEADLINE ]; do
60+
if timeout 1 bash -c "echo >/dev/tcp/localhost/10085" 2>/dev/null; then
61+
READY=1; break
62+
fi
63+
sleep 1
64+
done
65+
66+
if [ $READY -eq 1 ]; then
67+
echo "✓ (PID $PID, port 10085 UP)"
68+
elif kill -0 "$PID" 2>/dev/null; then
69+
echo "~ (PID $PID alive, port 10085 not yet bound — timeout)"
5970
else
6071
echo "✗ (FAILED)"
6172
rm -f "$PID_FILE"

modules/gray/start-backend.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ cd "$MOD_ROOT"
5252
java $JVM_OPTS -cp "$CP" "$MODULE_CLASS" >> "$LOG_DIR/backend.log" 2>&1 &
5353
PID=$!
5454
echo "$PID" > "$PID_FILE"
55-
sleep 1
5655

57-
if kill -0 "$PID" 2>/dev/null; then
58-
echo "✓ (PID $PID)"
56+
# ── Port-probe callback (10s timeout) ────────────────────────────────────────
57+
DEADLINE=$((SECONDS + 10))
58+
READY=0
59+
while [ $SECONDS -lt $DEADLINE ]; do
60+
if timeout 1 bash -c "echo >/dev/tcp/localhost/9999" 2>/dev/null; then
61+
READY=1; break
62+
fi
63+
sleep 1
64+
done
65+
66+
if [ $READY -eq 1 ]; then
67+
echo "✓ (PID $PID, port 9999 UP)"
68+
elif kill -0 "$PID" 2>/dev/null; then
69+
echo "~ (PID $PID alive, port 9999 not yet bound — timeout)"
5970
else
6071
echo "✗ (FAILED)"
6172
rm -f "$PID_FILE"

modules/library/start-backend.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ cd "$MOD_ROOT"
5252
java $JVM_OPTS -cp "$CP" "$MODULE_CLASS" >> "$LOG_DIR/backend.log" 2>&1 &
5353
PID=$!
5454
echo "$PID" > "$PID_FILE"
55-
sleep 1
5655

57-
if kill -0 "$PID" 2>/dev/null; then
58-
echo "✓ (PID $PID)"
56+
# ── Port-probe callback (10s timeout) ────────────────────────────────────────
57+
DEADLINE=$((SECONDS + 10))
58+
READY=0
59+
while [ $SECONDS -lt $DEADLINE ]; do
60+
if timeout 1 bash -c "echo >/dev/tcp/localhost/49214" 2>/dev/null; then
61+
READY=1; break
62+
fi
63+
sleep 1
64+
done
65+
66+
if [ $READY -eq 1 ]; then
67+
echo "✓ (PID $PID, port 49214 UP)"
68+
elif kill -0 "$PID" 2>/dev/null; then
69+
echo "~ (PID $PID alive, port 49214 not yet bound — timeout)"
5970
else
6071
echo "✗ (FAILED)"
6172
rm -f "$PID_FILE"

modules/nsa/start-backend.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ cd "$MOD_ROOT"
5252
java $JVM_OPTS -cp "$CP" "$MODULE_CLASS" >> "$LOG_DIR/backend.log" 2>&1 &
5353
PID=$!
5454
echo "$PID" > "$PID_FILE"
55-
sleep 1
5655

57-
if kill -0 "$PID" 2>/dev/null; then
58-
echo "✓ (PID $PID)"
56+
# ── Port-probe callback (10s timeout) ────────────────────────────────────────
57+
DEADLINE=$((SECONDS + 10))
58+
READY=0
59+
while [ $SECONDS -lt $DEADLINE ]; do
60+
if timeout 1 bash -c "echo >/dev/tcp/localhost/49212" 2>/dev/null; then
61+
READY=1; break
62+
fi
63+
sleep 1
64+
done
65+
66+
if [ $READY -eq 1 ]; then
67+
echo "✓ (PID $PID, port 49212 UP)"
68+
elif kill -0 "$PID" 2>/dev/null; then
69+
echo "~ (PID $PID alive, port 49212 not yet bound — timeout)"
5970
else
6071
echo "✗ (FAILED)"
6172
rm -f "$PID_FILE"

modules/red/Futures/start-backend.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ cd "$MOD_ROOT"
5252
java $JVM_OPTS -cp "$CP" "$MODULE_CLASS" >> "$LOG_DIR/backend.log" 2>&1 &
5353
PID=$!
5454
echo "$PID" > "$PID_FILE"
55-
sleep 1
5655

57-
if kill -0 "$PID" 2>/dev/null; then
58-
echo "✓ (PID $PID)"
56+
# ── Port-probe callback (10s timeout) ────────────────────────────────────────
57+
DEADLINE=$((SECONDS + 10))
58+
READY=0
59+
while [ $SECONDS -lt $DEADLINE ]; do
60+
if timeout 1 bash -c "echo >/dev/tcp/localhost/5000" 2>/dev/null; then
61+
READY=1; break
62+
fi
63+
sleep 1
64+
done
65+
66+
if [ $READY -eq 1 ]; then
67+
echo "✓ (PID $PID, port 5000 UP)"
68+
elif kill -0 "$PID" 2>/dev/null; then
69+
echo "~ (PID $PID alive, port 5000 not yet bound — timeout)"
5970
else
6071
echo "✗ (FAILED)"
6172
rm -f "$PID_FILE"

scripts/web/web-deploy-config.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Edit this file to enable/disable modules before running deploy scripts.
66
-->
77
<web-deploy>
8-
<tomcat-home>/home/mearvk/tomcat</tomcat-home>
8+
<tomcat-home>/opt/tomcat</tomcat-home>
99
<mysql-host>127.0.0.1</mysql-host>
1010
<mysql-port>3306</mysql-port>
1111
<mysql-user>root</mysql-user>
@@ -42,8 +42,8 @@
4242
<module id="futures">
4343
<enabled>true</enabled>
4444
<context>futures</context>
45-
<deploy-script>modules/black/red/Futures/servlets/deploy-local.sh</deploy-script>
46-
<setup-script>modules/black/red/Futures/servlets/setup-db.sh</setup-script>
45+
<deploy-script>modules/red/Futures/servlets/deploy-local.sh</deploy-script>
46+
<setup-script>modules/red/Futures/servlets/setup-db.sh</setup-script>
4747
<database>nwe_futures</database>
4848
<install>true</install>
4949
<start>true</start>
@@ -54,8 +54,8 @@
5454
<module id="gdgh">
5555
<enabled>true</enabled>
5656
<context>gdgh</context>
57-
<deploy-script>modules/black/presidential/Green.Durham.Grass.and.Herb/servlets/deploy-local.sh</deploy-script>
58-
<setup-script>modules/black/presidential/Green.Durham.Grass.and.Herb/servlets/setup-db.sh</setup-script>
57+
<deploy-script>modules/Green.Durham.Grass.and.Herb/servlets/deploy-local.sh</deploy-script>
58+
<setup-script>modules/Green.Durham.Grass.and.Herb/servlets/setup-db.sh</setup-script>
5959
<database>nwe_gdgh</database>
6060
<install>true</install>
6161
<start>true</start>
@@ -66,7 +66,7 @@
6666
<module id="blackbelt">
6767
<enabled>true</enabled>
6868
<context>blackbelt</context>
69-
<deploy-script>modules/black/belt/servlets/deploy-local.sh</deploy-script>
69+
<deploy-script>modules/black-belt/servlets/deploy-local.sh</deploy-script>
7070
<database>nwe_blackbelt</database>
7171
<install>true</install>
7272
<start>true</start>
@@ -121,8 +121,8 @@
121121
<module id="california-fbi">
122122
<enabled>true</enabled>
123123
<context>california-fbi</context>
124-
<deploy-script>california/fbi/servlets/deploy-local.sh</deploy-script>
125-
<setup-script>california/fbi/servlets/setup-db.sh</setup-script>
124+
<deploy-script>modules/fbi/servlets/deploy-local.sh</deploy-script>
125+
<setup-script>modules/fbi/servlets/setup-db.sh</setup-script>
126126
<database>nwe_california_fbi</database>
127127
<install>true</install>
128128
<start>true</start>
@@ -133,8 +133,8 @@
133133
<module id="california-cia">
134134
<enabled>true</enabled>
135135
<context>california-cia</context>
136-
<deploy-script>california/cia/servlets/deploy-local.sh</deploy-script>
137-
<setup-script>california/cia/servlets/setup-db.sh</setup-script>
136+
<deploy-script>modules/cia/servlets/deploy-local.sh</deploy-script>
137+
<setup-script>modules/cia/servlets/setup-db.sh</setup-script>
138138
<database>nwe_california_cia</database>
139139
<install>true</install>
140140
<start>true</start>
@@ -145,8 +145,8 @@
145145
<module id="california-nsa">
146146
<enabled>true</enabled>
147147
<context>california-nsa</context>
148-
<deploy-script>california/nsa/servlets/deploy-local.sh</deploy-script>
149-
<setup-script>california/nsa/servlets/setup-db.sh</setup-script>
148+
<deploy-script>modules/nsa/servlets/deploy-local.sh</deploy-script>
149+
<setup-script>modules/nsa/servlets/setup-db.sh</setup-script>
150150
<database>nwe_california_nsa</database>
151151
<install>true</install>
152152
<start>true</start>
@@ -157,8 +157,8 @@
157157
<module id="duke">
158158
<enabled>true</enabled>
159159
<context>duke</context>
160-
<deploy-script>north/carolina/duke/servlets/deploy-local.sh</deploy-script>
161-
<setup-script>north/carolina/duke/servlets/setup-db.sh</setup-script>
160+
<deploy-script>modules/duke/servlets/deploy-local.sh</deploy-script>
161+
<setup-script>modules/duke/servlets/setup-db.sh</setup-script>
162162
<database>nwe_duke</database>
163163
<install>true</install>
164164
<start>true</start>
@@ -169,8 +169,8 @@
169169
<module id="stanford-library">
170170
<enabled>true</enabled>
171171
<context>stanford-library</context>
172-
<deploy-script>north/carolina/library/servlets/deploy-local.sh</deploy-script>
173-
<setup-script>north/carolina/library/servlets/setup-db.sh</setup-script>
172+
<deploy-script>modules/library/servlets/deploy-local.sh</deploy-script>
173+
<setup-script>modules/library/servlets/setup-db.sh</setup-script>
174174
<database>nwe_library</database>
175175
<install>true</install>
176176
<start>true</start>

0 commit comments

Comments
 (0)