Spaces:
Paused
Paused
File size: 509 Bytes
1ad9716 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/bin/bash
set -e
# Gracefully wait if port 7860 is momentarily occupied by a previous process
for i in {1..10}; do
if ! python3 -c "import socket; s = socket.socket(); s.bind(('0.0.0.0', 7860)); s.close()" 2>/dev/null; then
echo "[start.sh] Port 7860 busy, waiting for release (attempt $i/10)..."
fuser -k 7860/tcp 2>/dev/null || true
sleep 1
else
break
fi
done
echo "[start.sh] Port 7860 is free. Starting Uvicorn on 0.0.0.0:7860..."
exec uvicorn app:app --host 0.0.0.0 --port 7860
|