The rollup and the backup check in once, when they end, with the run's duration
A start and a finish sent seconds apart can reach Sentry in either order, and a start that lands second is never closed, so a fast rollup could be reported as a timeout on a night it succeeded. Hnefatafl's monitor did so nine nights in fifteen on the shared host. One check-in at the end cannot race; a run that hangs sends nothing and is marked missed. Installed on the host by hand; the next deploy installs the same files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GwFKMuQnPAEHJ5yA1q4orh
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
aeb58bdf4a
commit
ad23c83b8a
@@ -11,7 +11,12 @@ STAMP=$(date +%Y-%m-%d)
|
||||
# Sentry Crons check-in: /root/.wizwar-sentry-cron holds the check-in URL
|
||||
# (auto-creates the monitor on first ping). Absent file = no check-ins.
|
||||
CRON_URL=$(cat /root/.wizwar-sentry-cron 2>/dev/null || true)
|
||||
checkin() { [ -n "$CRON_URL" ] && curl -sf -o /dev/null "$CRON_URL?status=$1" || true; }
|
||||
# One check-in, when the run ends, carrying its duration: a start and a
|
||||
# finish sent seconds apart can reach Sentry in either order, and a start
|
||||
# that lands second is never closed. A run that never ends sends nothing,
|
||||
# and Sentry marks the night missed.
|
||||
START=$SECONDS
|
||||
checkin() { [ -n "$CRON_URL" ] && curl -sf -o /dev/null "$CRON_URL?status=$1&duration=$((SECONDS - START))" || true; }
|
||||
|
||||
if grep -q CHANGE_ME /root/.config/rclone/rclone.conf; then
|
||||
echo "$(date -Is) skipped: Spaces credentials not configured yet" >> "$LOG"
|
||||
@@ -20,7 +25,6 @@ fi
|
||||
|
||||
{
|
||||
echo "=== $(date -Is) backup start"
|
||||
checkin in_progress
|
||||
if rclone sync "$SRC" "spaces:$BUCKET/wizwar/current" 2>&1 &&
|
||||
rclone copy "$SRC" "spaces:$BUCKET/wizwar/snapshots/$STAMP" 2>&1; then
|
||||
checkin ok
|
||||
|
||||
Reference in New Issue
Block a user