#!/bin/bash # Portal backup cron wrapper — runs backup_portal.py, silent on success # Called by Hermes cron job set -euo pipefail LOG_FILE="/root/.hermes/logs/portal-backup.log" mkdir -p "$(dirname "$LOG_FILE")" # Source any env vars from a .env if it exists [ -f /root/.hermes/.env ] && source /root/.hermes/.env echo "[$(date -u '+%Y-%m-%d %H:%M:%S')] Starting portal backup..." >> "$LOG_FILE" # Run the backup script python3 /root/.hermes/scripts/backup_portal.py --target all 2>&1 | tee -a "$LOG_FILE" EXIT_CODE=$? if [ $EXIT_CODE -eq 0 ]; then echo "[$(date -u '+%Y-%m-%d %H:%M:%S')] Portal backup completed successfully" >> "$LOG_FILE" else echo "[$(date -u '+%Y-%m-%d %H:%M:%S')] ❌ Portal backup FAILED (exit $EXIT_CODE)" >> "$LOG_FILE" fi exit $EXIT_CODE