added:增加Linux-server

This commit is contained in:
Vaica committed 2026-06-21 20:42:44 +08:00
1 parent 712116d21d
commit bd96aadb2f
90 files changed
+16784 -1

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
# Write Server 健康检查脚本
# 用于 Docker 健康检查或监控系统
set -e
# 配置
PORT=${PORT:-8016}
HOST=${HOST:-localhost}
TIMEOUT=${HEALTH_CHECK_TIMEOUT:-5}
# 检查服务是否响应
check_health() {
local url="http://${HOST}:${PORT}/api/stats"
local response
# 发送请求
response=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout "$TIMEOUT" --max-time "$TIMEOUT" "$url" 2>/dev/null || echo "000")
# 检查响应状态码
if [ "$response" = "200" ]; then
return 0
else
return 1
fi
}
# 主检查逻辑
main() {
if check_health; then
echo "Health check passed"
exit 0
else
echo "Health check failed"
exit 1
fi
}
main