mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
25 lines
545 B
Bash
25 lines
545 B
Bash
#!/bin/bash
|
|
|
|
check_ports() {
|
|
for port in "$@"; do
|
|
if ss -tuln | grep -q ":$port "; then
|
|
echo "❌ Port $port is already in use"
|
|
return 1
|
|
fi
|
|
done
|
|
return 0
|
|
}
|
|
|
|
wait_for_health() {
|
|
local server_port=$1
|
|
while true; do
|
|
status_code=$(curl -s -o /dev/null -w "%{http_code}" "http://0.0.0.0:${server_port}/health" || echo "000")
|
|
if [ "$status_code" -eq 200 ]; then
|
|
break
|
|
else
|
|
echo "Service not ready. Retrying in 4s..."
|
|
sleep 4
|
|
fi
|
|
done
|
|
}
|