-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathstop-all-services.sh
More file actions
executable file
·56 lines (47 loc) · 1.52 KB
/
Copy pathstop-all-services.sh
File metadata and controls
executable file
·56 lines (47 loc) · 1.52 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
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
echo "=========================================="
echo "Stopping All Polybot Services"
echo "=========================================="
echo ""
cd "$(dirname "$0")"
# Function to stop a service
stop_service() {
local service_name=$1
local pid_file="logs/${service_name}.pid"
if [ -f "$pid_file" ]; then
local pid=$(cat "$pid_file")
if ps -p $pid > /dev/null 2>&1; then
echo "Stopping ${service_name} (PID: $pid)..."
kill $pid
sleep 2
# Force kill if still running
if ps -p $pid > /dev/null 2>&1; then
echo " Force stopping ${service_name}..."
kill -9 $pid
fi
echo " ✓ Stopped"
else
echo "${service_name} is not running (stale PID file)"
fi
rm -f "$pid_file"
else
echo "${service_name}: No PID file found"
fi
}
# Stop services in reverse order
stop_service "analytics-service"
stop_service "ingestor-service"
stop_service "strategy-service"
stop_service "executor-service"
# Stop infrastructure orchestrator last (it will stop all Docker stacks)
echo ""
echo "Stopping infrastructure-orchestrator-service..."
echo "(This will stop: Redpanda, ClickHouse, Prometheus, Grafana, Alertmanager)"
stop_service "infrastructure-orchestrator-service"
# Wait for Docker cleanup
sleep 2
echo ""
echo "=========================================="
echo "✓ All services stopped"
echo "=========================================="
echo ""