changed stop-servers to better kill the process on updates and added test cases for feature
This commit is contained in:
@@ -1,18 +1,37 @@
|
||||
#!/bin/bash
|
||||
echo "Stopping CVE Dashboard servers..."
|
||||
|
||||
# Kill by PID files if they exist
|
||||
if [ -f backend.pid ]; then
|
||||
kill $(cat backend.pid) 2>/dev/null
|
||||
rm backend.pid
|
||||
echo "✓ Backend stopped"
|
||||
echo "✓ Backend stopped (via pid)"
|
||||
fi
|
||||
|
||||
if [ -f frontend.pid ]; then
|
||||
kill $(cat frontend.pid) 2>/dev/null
|
||||
rm frontend.pid
|
||||
echo "✓ Frontend stopped"
|
||||
echo "✓ Frontend stopped (via pid)"
|
||||
fi
|
||||
|
||||
pkill -f "node server.js"
|
||||
pkill -f "react-scripts start"
|
||||
echo "All servers stopped"
|
||||
# Force kill all node processes related to this project
|
||||
pkill -9 -f "node.*server.js" 2>/dev/null
|
||||
pkill -9 -f "react-scripts" 2>/dev/null
|
||||
pkill -9 -f "webpack" 2>/dev/null
|
||||
|
||||
# Wait a moment and verify
|
||||
sleep 1
|
||||
|
||||
# Check if any are still running
|
||||
if pgrep -f "react-scripts" > /dev/null; then
|
||||
echo "⚠ Some React processes still running, force killing..."
|
||||
pkill -9 -f "react-scripts"
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
if pgrep -f "node.*server.js" > /dev/null; then
|
||||
echo "⚠ Backend still running, force killing..."
|
||||
pkill -9 -f "node.*server.js"
|
||||
fi
|
||||
|
||||
echo "✓ All servers stopped"
|
||||
|
||||
Reference in New Issue
Block a user