#!/bin/sh
# 醒来即补推：检查"今天"和"昨天"是否有未发送的学习报告，有则补推。
# 由 launchd 在开机/唤醒后按间隔自动调用，脚本内置去重与"无数据跳过"，不会重复发送。
WS="/Users/zhangwen/.local/share/TeleAgent/TeleAgent的工作空间/学习工作台"
PY="/Users/zhangwen/.local/share/TeleAgent/runtimes/python/bin/python3"
[ -x "$PY" ] || PY="/usr/bin/python3"
LOG="$WS/.temp/auto_push.log"
cd "$WS" || exit 1
echo "[$(date '+%Y-%m-%d %H:%M:%S')] auto_push 开始" >> "$LOG"
"$PY" "$WS/.temp/push_report.py"            >> "$LOG" 2>&1   # 今天
"$PY" "$WS/.temp/push_report.py" --yesterday >> "$LOG" 2>&1  # 昨天
echo "[$(date '+%Y-%m-%d %H:%M:%S')] auto_push 结束" >> "$LOG"