Switch start/stop scripts to use systemd services
This commit is contained in:
@@ -1,22 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Starting CVE Dashboard servers..."
|
echo "Starting CVE Dashboard servers..."
|
||||||
|
|
||||||
# Start backend
|
sudo systemctl start cve-backend
|
||||||
cd backend
|
echo "✓ Backend started"
|
||||||
nohup node server.js > backend.log 2>&1 &
|
|
||||||
BACKEND_PID=$!
|
|
||||||
echo "Backend started (PID: $BACKEND_PID)"
|
|
||||||
|
|
||||||
# Start frontend
|
sudo systemctl start cve-frontend
|
||||||
cd ../frontend
|
echo "✓ Frontend started"
|
||||||
nohup npm start > frontend.log 2>&1 &
|
|
||||||
FRONTEND_PID=$!
|
|
||||||
echo "Frontend started (PID: $FRONTEND_PID)"
|
|
||||||
|
|
||||||
# Save PIDs
|
sleep 1
|
||||||
echo $BACKEND_PID > ../backend.pid
|
|
||||||
echo $FRONTEND_PID > ../frontend.pid
|
|
||||||
|
|
||||||
echo "✓ Both servers running in background"
|
# Show status
|
||||||
echo " Backend: http://localhost:3001"
|
systemctl is-active --quiet cve-backend && echo " Backend: http://localhost:3001 (running)" || echo " Backend: FAILED"
|
||||||
echo " Frontend: http://localhost:3000"
|
systemctl is-active --quiet cve-frontend && echo " Frontend: http://localhost:3000 (running)" || echo " Frontend: FAILED"
|
||||||
|
|||||||
@@ -1,37 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Stopping CVE Dashboard servers..."
|
echo "Stopping CVE Dashboard servers..."
|
||||||
|
|
||||||
# Kill by PID files if they exist
|
sudo systemctl stop cve-backend
|
||||||
if [ -f backend.pid ]; then
|
echo "✓ Backend stopped"
|
||||||
kill $(cat backend.pid) 2>/dev/null
|
|
||||||
rm backend.pid
|
|
||||||
echo "✓ Backend stopped (via pid)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f frontend.pid ]; then
|
sudo systemctl stop cve-frontend
|
||||||
kill $(cat frontend.pid) 2>/dev/null
|
echo "✓ Frontend stopped"
|
||||||
rm frontend.pid
|
|
||||||
echo "✓ Frontend stopped (via pid)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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