Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/healer-pro-pack / heal_ports.sh |
| Date | Not specified in source |
| Repository | Janady13/healer-pro-pack |
| Revision | 8cd241e17bd004fdbdc1ee5e9913e45304671553 |
| Branch | main |
| Path or archive member | heal_ports.sh |
| Original SHA-256 | c0e0d50b73c04cc196b5a450b4dda95cee5dafccd9b7dbeeed1e5ae8a882771a |
| Git blob SHA | e149bb00e8e7d920fe2051d092bcca4b838247c4 |
| Reading-copy SHA-256 | c0e0d50b73c04cc196b5a450b4dda95cee5dafccd9b7dbeeed1e5ae8a882771a |
Recovered source transcript
Download complete source text ↓47 lines · 1.2 KB
#!/bin/bash
set -euo pipefail
APP="webhook_server:app"
APP_DIR="$HOME/Desktop/AI_Healer_Files"
LOG_DIR="$APP_DIR/healer_logs"
mkdir -p "$LOG_DIR"
while true; do
TS=$(date +"%Y-%m-%d_%H-%M-%S")
# Find a free port
PORT=$(python3 - <<'PYCODE'
import socket
s=socket.socket()
s.bind(('',0))
print(s.getsockname()[1])
s.close()
PYCODE
)
echo "🌍 Healing ports... found free port: $PORT" | tee -a "$LOG_DIR/webhook_$TS.log"
cd "$APP_DIR"
# Start uvicorn (logs → file)
uvicorn "$APP" --reload --port $PORT >> "$LOG_DIR/webhook_$TS.log" 2>&1 &
UVICORN_PID=$!
echo "🚀 Webhook server running on port $PORT (PID $UVICORN_PID)" | tee -a "$LOG_DIR/webhook_$TS.log"
# Start Stripe listener (logs → file)
stripe listen --forward-to localhost:$PORT/webhook >> "$LOG_DIR/stripe_$TS.log" 2>&1 &
STRIPE_PID=$!
echo "⚡ Stripe listener running (PID $STRIPE_PID)" | tee -a "$LOG_DIR/webhook_$TS.log"
# Wait for uvicorn
wait $UVICORN_PID
EXIT_CODE=$?
echo "❌ Uvicorn crashed with exit code $EXIT_CODE" | tee -a "$LOG_DIR/webhook_$TS.log"
echo "🩹 Restarting in 5 seconds..." | tee -a "$LOG_DIR/webhook_$TS.log"
kill $STRIPE_PID 2>/dev/null || true
sleep 5
done