#!/bin/bash
# keep_alive.sh - GoldAutoTrade 看门狗
# 每2分钟运行一次，自动巡查 + 自愈

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
LOG="$SCRIPT_DIR/logs/keep_alive.log"

mkdir -p "$(dirname "$LOG")"

echo "[$(date '+%Y-%m-%d %H:%M:%S')] === keep_alive.sh 触发 ===" >> "$LOG"

python3 "$SCRIPT_DIR/bridge/health_watchdog.py" 2>&1 | tee -a "$LOG"

echo "[$(date '+%Y-%m-%d %H:%M:%S')] === keep_alive.sh 结束 ===" >> "$LOG"
