-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop.sh
More file actions
executable file
·79 lines (69 loc) · 2.02 KB
/
stop.sh
File metadata and controls
executable file
·79 lines (69 loc) · 2.02 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# EnglishConnect Stop Script
#
# Stops all running services and infrastructure.
#
# Usage:
# ./stop.sh # Stop everything
# ./stop.sh services # Stop only local services (keep infra running)
# ./stop.sh infra # Stop only infrastructure
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
# Stop local services
stop_services() {
log_info "Stopping local services..."
if [ -d ".pids" ]; then
for pidfile in .pids/*.pid; do
if [ -f "$pidfile" ]; then
pid=$(cat "$pidfile")
service_name=$(basename "$pidfile" .pid)
if kill -0 "$pid" 2>/dev/null; then
log_info "Stopping $service_name (PID: $pid)..."
kill "$pid" 2>/dev/null || true
fi
rm "$pidfile"
fi
done
rmdir .pids 2>/dev/null || true
fi
# Also kill any remaining processes for this project
pkill -f "src/services/content-mcp/server.py" 2>/dev/null || true
pkill -f "src/services/stt/server" 2>/dev/null || true
log_info "Local services stopped."
}
# Stop infrastructure (PostgreSQL, Redis)
stop_infra() {
log_info "Stopping infrastructure (PostgreSQL, Redis)..."
docker compose down
log_info "Infrastructure stopped."
}
# Main command handling
case "${1:-all}" in
services)
stop_services
;;
infra)
stop_infra
;;
all|"")
stop_services
stop_infra
;;
*)
echo "Usage: $0 [services|infra|all]"
echo ""
echo "Commands:"
echo " services - Stop only local services (keep infra running)"
echo " infra - Stop only infrastructure (PostgreSQL, Redis)"
echo " all - Stop everything (default)"
exit 1
;;
esac