Files
2026-08-03 11:47:09 -04:00

21 lines
719 B
Python

#!/usr/bin/env python3
"""Fetch ICS into local cache. Watchdog: silent on success, error only on fail.
Replaces old Pi cron: 0 * * * * calendar_fetch.py <ics_url>
Now used as fallback when Mac Mini is unreachable.
"""
import subprocess
import sys
result = subprocess.run(
["uv", "run", "reyna-cli", "calendar", "fetch", "--json"],
cwd="/home/adolforeyna/reyna-cli",
text=True,
capture_output=True,
)
if result.returncode != 0:
# Print so Hermes delivery shows error (non-empty stdout = delivered)
print(result.stdout[-2000:] if result.stdout else "")
print(result.stderr[-2000:] if result.stderr else "", file=sys.stderr)
sys.exit(1)
# Success -> silent (no delivery), watchdog pattern