improve: comprehensive process cleanup in startup script
- Add -9 (force kill) flag to all pkill commands - Kill Python backend processes explicitly - Kill npm and node processes - Use fuser to kill processes bound to ports 8000, 3001, 3002, 3003 - Add 1 second wait after cleanup - Ensures absolutely clean state before restart
This commit is contained in:
@@ -17,11 +17,28 @@ fi
|
|||||||
|
|
||||||
echo "🚀 Starting TFM aInventory Stack with Dual Proxy..."
|
echo "🚀 Starting TFM aInventory Stack with Dual Proxy..."
|
||||||
|
|
||||||
# 1. Kill potentially hanging processes
|
# 1. COMPREHENSIVE process cleanup - ensure absolute clean state
|
||||||
echo "Sweep: Cleaning up old processes..."
|
echo "Sweep: Comprehensive process cleanup..."
|
||||||
pkill -f "uvicorn" || true
|
|
||||||
pkill -f "next-server" || true
|
# Kill all known hanging processes
|
||||||
pkill -f "local-ssl-proxy" || true
|
pkill -9 -f "uvicorn" 2>/dev/null || true
|
||||||
|
pkill -9 -f "next-server" 2>/dev/null || true
|
||||||
|
pkill -9 -f "local-ssl-proxy" 2>/dev/null || true
|
||||||
|
pkill -9 -f "python.*backend" 2>/dev/null || true
|
||||||
|
pkill -9 -f "python.*main:app" 2>/dev/null || true
|
||||||
|
pkill -9 -f "npm run dev" 2>/dev/null || true
|
||||||
|
pkill -9 -f "node.*next" 2>/dev/null || true
|
||||||
|
|
||||||
|
# Kill any remaining Python processes on port 8000 (backend)
|
||||||
|
fuser -k 8000/tcp 2>/dev/null || true
|
||||||
|
fuser -k 3001/tcp 2>/dev/null || true
|
||||||
|
fuser -k 3002/tcp 2>/dev/null || true
|
||||||
|
fuser -k 3003/tcp 2>/dev/null || true
|
||||||
|
|
||||||
|
# Extra wait to ensure processes are fully dead
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
echo "✅ Cleanup complete - all processes terminated"
|
||||||
|
|
||||||
# 2. Setup/Activate Virtual Environment
|
# 2. Setup/Activate Virtual Environment
|
||||||
if [ ! -f ".venv/bin/activate" ]; then
|
if [ ! -f ".venv/bin/activate" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user