Quasar-Executo / entrypoint.sh
KarlQuant's picture
Update entrypoint.sh
bcf61a1 verified
#!/bin/bash
# ════════════════════════════════════════════════════════════════
# K1RL QUASAR β€” Entrypoint
# Cleans up any stale processes/ports before launching supervisord
# ════════════════════════════════════════════════════════════════
set -e
echo "=== QUASAR entrypoint: cleaning up stale state ==="
# Kill any lingering supervisord from a previous run
pkill -f supervisord 2>/dev/null || true
# Kill any lingering hub/ranker/dashboard Python processes
pkill -f websocket_hub.py 2>/dev/null || true
pkill -f Quasar_axrvi_ranker.py 2>/dev/null || true
pkill -f hub_dashboard_service.py 2>/dev/null || true
# Give OS enough time to fully release sockets (7860, 8051, etc.)
sleep 3
# Remove stale PID and socket files
rm -f /tmp/supervisord.pid
rm -f /tmp/supervisor.sock
# Confirm our app files exist (catches missing-file issues early)
for f in /app/websocket_hub.py /app/Quasar_axrvi_ranker.py /app/hub_dashboard_service.py; do
if [ ! -f "$f" ]; then
echo "ERROR: Required file missing: $f"
echo "Make sure it is committed to your HF Space repository."
exit 1
fi
done
echo "=== Starting supervisord ==="
exec /usr/bin/supervisord -c /etc/supervisord.conf