-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop-all-services.sh
More file actions
executable file
·44 lines (36 loc) · 1.04 KB
/
stop-all-services.sh
File metadata and controls
executable file
·44 lines (36 loc) · 1.04 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
37
38
39
40
41
42
43
44
#!/bin/bash
# Stop all services for the zero-trust auth demo
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${BLUE}🛑 Stopping Zero-Trust Authentication Demo Services${NC}"
echo "=================================================="
echo ""
# Function to kill process on port
kill_port() {
local port=$1
local name=$2
if lsof -ti:$port > /dev/null 2>&1; then
echo -n "Stopping $name (port $port)..."
lsof -ti:$port | xargs kill -9 2>/dev/null
echo -e " ${GREEN}✓${NC}"
else
echo -e "$name (port $port): ${RED}not running${NC}"
fi
}
# Try to kill from saved PIDs first
if [ -f "logs/pids.txt" ]; then
echo "Stopping services from saved PIDs..."
kill $(cat logs/pids.txt) 2>/dev/null && echo -e "${GREEN}✓${NC} Stopped" || echo "No processes from PIDs file"
rm logs/pids.txt
echo ""
fi
# Kill by port as backup
kill_port 4000 "Apollo Router"
kill_port 4001 "Subgraphs"
kill_port 3080 "Coprocessor"
kill_port 3090 "OBO Service"
echo ""
echo -e "${GREEN}✅ All services stopped${NC}"