-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstop.sh
42 lines (34 loc) · 1011 Bytes
/
stop.sh
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
37
38
39
40
41
42
#!/bin/bash
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Function to print colored output
print_color() {
color=$1
message=$2
echo -e "${color}${message}${NC}"
}
# Stop the Flask server
print_color $YELLOW "Stopping Flask server..."
pkill -f "python backend/app.py"
# Forcefully terminate any process using port 5001
lsof -ti:5001 | xargs kill -9
# Stop the http-server
print_color $YELLOW "Stopping http-server..."
pkill -f "http-server"
# Check if processes are still running
if pgrep -f "python backend/app.py" > /dev/null || lsof -ti:5001 > /dev/null
then
print_color $RED "Failed to stop Flask server. Please stop it manually."
else
print_color $GREEN "Flask server stopped successfully."
fi
if pgrep -f "http-server" > /dev/null
then
print_color $RED "Failed to stop http-server. Please stop it manually."
else
print_color $GREEN "http-server stopped successfully."
fi
print_color $GREEN "Stop script completed."