#!/bin/bash # 配置企业微信机器人Webhook URL WEBHOOK_URL="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=your_webhook_key" # 检查xtpsvr进程是否运行 if ps -ef | grep -q '[x]tpsvr'; then exit 0 # 进程正常运行,静默退出 else # 构造告警消息 ALERT_MSG=" xtpsvr进程已停止运行!\n> 服务器: $(hostname)\n> 时间: $(date "+%Y-%m-%d %H:%M:%S")" # JSON消息体 JSON_MSG=$(cat </dev/null 2>&1 & exit 1 fi