Files
Work-configuration-file/jenkins/流水线配置/s1_jennie.im/check_s1_backend_status.sh
2025-10-07 15:58:15 +08:00

13 lines
382 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 检查指定端口的节点状态up/down
PORT=$1
NGINX_CONFIG="/data/tengine/conf/vhosts/s1.jennie.im.conf"
if [ -z "$PORT" ]; then
echo "用法: $0 <port>"
exit 1
fi
# 检查配置中是否包含"down"关键字
STATUS=$(grep "server 10.0.0.5:$PORT" $NGINX_CONFIG | grep -q "down" && echo "down" || echo "up")
echo $STATUS # 输出结果down 或 up