-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop.sh
More file actions
36 lines (30 loc) · 1.1 KB
/
Copy pathstop.sh
File metadata and controls
36 lines (30 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# CoreAI Stop Script
# This script stops all CoreAI services
echo "🛑 Stopping CoreAI services..."
if [ -f ".pids" ]; then
while IFS= read -r pid; do
if ps -p $pid > /dev/null 2>&1; then
echo " Stopping process $pid..."
kill $pid 2>/dev/null
fi
done < .pids
rm .pids
echo "✅ All services stopped"
else
echo "⚠️ No PID file found. Attempting to stop by port..."
# Kill processes on known ports
if command -v lsof &> /dev/null; then
lsof -ti:3000 | xargs kill -9 2>/dev/null
lsof -ti:3001 | xargs kill -9 2>/dev/null
lsof -ti:5001 | xargs kill -9 2>/dev/null
elif command -v netstat &> /dev/null; then
# Windows
for /f "tokens=5" %%a in ('netstat -ano ^| findstr :3000') do taskkill /F /PID %%a 2>nul
for /f "tokens=5" %%a in ('netstat -ano ^| findstr :3001') do taskkill /F /PID %%a 2>nul
for /f "tokens=5" %%a in ('netstat -ano ^| findstr :5001') do taskkill /F /PID %%a 2>nul
fi
echo "✅ Attempted to stop all services"
fi
echo ""
echo "🏁 CoreAI stopped"