-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstop.sh
More file actions
executable file
·34 lines (31 loc) · 903 Bytes
/
stop.sh
File metadata and controls
executable file
·34 lines (31 loc) · 903 Bytes
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
#!/bin/bash
# Function to check if backend is running and healthy
check_backend() {
if curl -s http://localhost:3000/api/monitoring/health > /dev/null; then
return 0
else
return 1
fi
}
# Function to force stop backend processes
force_stop_backend() {
echo "🛑 Stopping backend processes..."
# Find and kill Node.js processes containing fullstack-starter in their path
ps aux | grep "[n]ode.*fullstack-starter" | awk '{print $2}' | xargs -r kill -9
sleep 1
if check_backend; then
echo "❌ Failed to stop all backend processes"
return 1
else
echo "✅ Backend processes stopped successfully"
return 0
fi
}
# Only run the main function if this script is being run directly (not sourced)
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
if force_stop_backend; then
exit 0
else
exit 1
fi
fi