| 12345678910111213141516171819202122232425262728293031323334353637 |
- #!/bin/bash
- # 后端服务停止脚本
- RED='\033[0;31m'
- GREEN='\033[0;32m'
- YELLOW='\033[1;33m'
- NC='\033[0m'
- echo -e "${YELLOW}停止后端服务...${NC}"
- stop_service() {
- local service=$1
- local pidfile="logs/${service}.pid"
-
- if [ -f "$pidfile" ]; then
- pid=$(cat "$pidfile")
- if ps -p $pid > /dev/null 2>&1; then
- echo "停止 ${service} (PID: ${pid})"
- kill $pid
- rm "$pidfile"
- else
- echo "${service} 未运行"
- rm "$pidfile"
- fi
- else
- echo "${service} PID 文件不存在"
- fi
- }
- # 停止所有服务
- stop_service apigateway
- stop_service glance
- stop_service region
- stop_service keystone
- echo -e "${GREEN}✓ 后端服务已停止${NC}"
|