Companion repository for the ankurm.com article. Every transcript in docs/output/ was produced by running this project; scripts/run-all.sh regenerates all of them. Verified against Spring Boot 4.1.1 / Framework 7.0.9 / Security 7.1.1 / Micrometer 1.17.1 / kafka-clients 4.2.1 on Temurin JDK 25.0.4.1+1.
15 lines
675 B
Bash
Executable File
15 lines
675 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Kill by main class, never by a pattern that could match this script's own command line.
|
|
# `pkill -f spring-boot` matches the shell running it and takes the terminal with it.
|
|
set -u
|
|
for p in $(ps -eo pid,args | grep '[A]ctuatorProductionApplication' | awk '{print $1}'); do
|
|
kill -9 "$p" 2>/dev/null || true
|
|
done
|
|
# Wait for the port to actually close. Killing the PID is not the same as the socket being
|
|
# free, and a stale listener looks exactly like your configuration change having no effect.
|
|
for _ in $(seq 1 40); do
|
|
if ! (exec 3<>/dev/tcp/127.0.0.1/"${APP_PORT:-8080}") 2>/dev/null; then break; fi
|
|
sleep 0.25
|
|
done
|
|
exec 3<&- 2>/dev/null || true
|