Files
ai-proj-helper/skills/ops-tools-plugin/health-check.sh
John Qiu 99881e268a refactor: 合并 claude-marketplace,重构目录结构为单一仓库
- 重命名 plugins/ → skills/,个人插件迁移到 skills-personal/(gitignore)
- 更新 generate-marketplace.py 支持 config 读取和 skills-personal 扫描
- 新增 claude-config.yaml(技能启用/禁用 + MCP 配置)
- 新增 init.sh(交互式 MCP 初始化,支持 stdio/SSE 模式)
- 新增 CLAUDE.md 项目说明
- 重写 README.md 反映新结构
- 删除过时脚本:PUSH.sh、generate-marketplace.sh、convert-skills.sh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 11:11:59 +10:30

85 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# 服务器健康检查脚本
# 用法: ./health-check.sh [aliyun|website|all]
set -e
TOOLS_SERVER="root@101.200.136.200"
TOOLS_KEY="~/.ssh/tools.pem"
WEBSITE_SERVER="root@192.144.137.14"
WEBSITE_KEY="~/.ssh/officialWebsite.pem"
check_tools_server() {
echo "======================================"
echo "Tools 服务器 (101.200.136.200)"
echo "======================================"
ssh -i $TOOLS_KEY -o ConnectTimeout=5 $TOOLS_SERVER << 'EOF'
echo "--- 系统负载 ---"
uptime
echo ""
echo "--- 内存使用 ---"
free -h
echo ""
echo "--- 磁盘使用 ---"
df -h | grep -E '^/dev|Filesystem'
echo ""
echo "--- Docker 容器 ---"
docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'
echo ""
echo "--- 系统服务 ---"
echo -n "Jenkins: "; systemctl is-active jenkins
echo -n "Nginx: "; systemctl is-active nginx
echo -n "Docker: "; systemctl is-active docker
echo ""
echo "--- 端口检查 ---"
netstat -tlnp 2>/dev/null | grep -E ':3000|:8080|:10022|:5000' | awk '{print $4, $7}'
EOF
}
check_website_server() {
echo "======================================"
echo "Website 服务器 (192.144.137.14)"
echo "======================================"
ssh -i $WEBSITE_KEY -o ConnectTimeout=5 $WEBSITE_SERVER << 'EOF'
echo "--- 系统负载 ---"
uptime
echo ""
echo "--- 内存使用 ---"
free -h
echo ""
echo "--- 磁盘使用 ---"
df -h | grep -E '^/dev|Filesystem'
echo ""
echo "--- Nginx 状态 ---"
systemctl is-active nginx || echo "nginx not running"
EOF
}
case "${1:-all}" in
aliyun|tools)
check_tools_server
;;
website)
check_website_server
;;
all)
check_tools_server
echo ""
check_website_server
;;
*)
echo "用法: $0 [aliyun|website|all]"
exit 1
;;
esac