30 lines
956 B
Bash
30 lines
956 B
Bash
#!/bin/zsh
|
|
# Daily evidence-quality snapshot → Postgres (evidmon_metrics_daily).
|
|
#
|
|
# Same shape as weekly-report.sh: the machine clock is NOT Beijing, so cron
|
|
# invokes this hourly and the script self-gates on Asia/Shanghai time. It fires
|
|
# once a day at 09:00 北京时间 — early enough that the snapshot is waiting when
|
|
# the analyst pass runs, and late enough to include the previous night's runs.
|
|
#
|
|
# Args:
|
|
# (none) cron mode — gate on Beijing 09:00.
|
|
# --force bypass the gate and snapshot now.
|
|
|
|
set -e
|
|
REPO=${STREAMLINE_REPO:-/Users/fei/BBBBBBug}
|
|
BUN=${BUN_BIN:-/opt/homebrew/bin/bun}
|
|
LOG=$HOME/.streamline/evidmon_daily.log
|
|
|
|
cd "$REPO"
|
|
mkdir -p "$(dirname "$LOG")"
|
|
|
|
if [[ "${1:-}" != "--force" ]]; then
|
|
HOUR=$(TZ=Asia/Shanghai date +'%H')
|
|
if [[ "$HOUR" != "09" ]]; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
echo "===== $(TZ=Asia/Shanghai date '+%Y-%m-%d %H:%M:%S %Z') =====" >> "$LOG"
|
|
"$BUN" run control-server/src/evidmon_daily.ts >> "$LOG" 2>&1
|