mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
6b1cf70cd5
Former-commit-id: 4e4335591be6f906229115cef4fe9c42c11d70f1
23 lines
564 B
Bash
Executable File
23 lines
564 B
Bash
Executable File
#!/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"
|