Skip to content

Conversation

buildplan
Copy link
Owner

No description provided.

@buildplan buildplan self-assigned this Oct 4, 2025
@buildplan buildplan added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 4, 2025
@buildplan
Copy link
Owner Author

buildplan commented Oct 4, 2025

Date: 2025-10-04
CHANGELOG: Restic Backup Script v0.37.2 → v0.38

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

@buildplan buildplan requested a review from Copilot October 4, 2025 14:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds non-interactive restore functionality to support background operations and automated restore processes via cron jobs. The changes enable restoring data without user interaction, which supports implementing a 3-2-1 backup strategy by creating copies of backup data on different servers.

Key changes:

  • Added --background-restore command for non-blocking restore operations that run in the background
  • Added --sync-restore command for synchronous restore operations suitable for cron jobs
  • Refactored existing restore code to support both interactive and non-interactive modes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
restic-backup.sh Added background and synchronous restore functions, refactored ownership handling, updated help text and version
README.md Added Quick Start section, comprehensive restore documentation, and corrected a typo

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@buildplan buildplan requested a review from Copilot October 4, 2025 14:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@buildplan buildplan requested a review from Copilot October 4, 2025 15:14
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@buildplan buildplan merged commit ecbc9bc into main Oct 4, 2025
4 checks passed
@buildplan buildplan deleted the background_restore branch October 4, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant