Skip to content

v0.38

Choose a tag to compare

@buildplan buildplan released this 04 Oct 17:29
· 44 commits to main since this release
ecbc9bc

What's Changed

  • restore data in background or via cron job on a different server to create another copy of the data by @buildplan in #27

NEW FEATURES

  1. BACKGROUND RESTORE MODE (--background-restore)

    • NEW: Non-interactive restore that runs as a background process

    • Usage: sudo restic-backup.sh --background-restore <snapshot_id> <dest_path>

    • Features:

      • Accepts 'latest' as snapshot ID (auto-resolves to most recent snapshot)
      • Creates dedicated timestamped log files for each restore job
      • Runs in detached background process with output redirection
      • Sends notifications on completion/failure via configured channels
      • Automatically handles file ownership for /home/* paths
      • No terminal interaction required after launch
    • Implementation Details:

      • Uses subshell backgrounding: ( ... ) > "$restore_log" 2>&1 &
      • Log files: /tmp/restic-restore-${snapshot_id:0:8}-$(date +%s).log
      • Integrates with notification system (ntfy, Discord, Slack, Teams)
      • Runs pre-flight checks before starting background job
    • Use Cases:

      • Large dataset restoration without blocking terminal
      • Remote server restores over SSH
      • Long-running operations that should survive terminal disconnection
  2. SYNC RESTORE MODE (--sync-restore)

    • NEW: Non-interactive foreground restore for automation/cron

    • Usage: sudo restic-backup.sh --sync-restore <snapshot_id> <dest_path> [paths...]

    • Features:

      • Runs synchronously (blocks until completion)
      • Returns proper exit codes for scheduler/cron monitoring
      • Accepts optional specific file/directory paths to restore
      • Integrates with Healthchecks.io for success/failure pinging
      • Supports 'latest' snapshot ID resolution
      • Automatic ownership handling for user directories
    • Implementation Details:

      • Exit code 0 on success, 1 on failure
      • Healthchecks.io ping on completion: $HEALTHCHECKS_URL or $HEALTHCHECKS_URL/fail
      • Full logging to main log file
      • Notification support for all configured channels
    • Use Cases:

      • Automated backup pull for 3-2-1 backup strategy
      • Cron-scheduled regular restores to secondary servers
      • DR (Disaster Recovery) automation workflows
      • CI/CD backup restoration pipelines

Full Changelog: v0.37.2...v0.38