feat: add service start/stop orchestration scripts

Former-commit-id: 4e4335591be6f906229115cef4fe9c42c11d70f1
This commit is contained in:
反编译工作区
2026-05-01 19:47:18 +08:00
parent 8f1e3a2b39
commit 6b1cf70cd5
2 changed files with 105 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
+# stop-all.sh — 按逆序停止所有服务
+source "$(dirname "${BASH_SOURCE[0]}")/config/env.sh"
+
+log_info "Stopping all services..."
+
+for pid_file in "$LOG_DIR"/*.pid; do
+ if [[ -f "$pid_file" ]]; then
+ pid=$(cat "$pid_file")
+ svc=$(basename "$pid_file" .pid)
+ if kill -0 "$pid" 2>/dev/null; then
+ log_info "Stopping $svc (pid=$pid)..."
+ kill "$pid"
+ sleep 2
+ kill -9 "$pid" 2>/dev/null || true
+ log_ok " $svc stopped"
+ fi
+ rm -f "$pid_file"
+ fi
+done
+
+log_info "All services stopped"