diff --git a/README.md b/README.md index 6a9203f..8685556 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ logic remains common and can be updated through Git. `backup.sh` runs these stages in order: 1. `stages/10-containers.sh` — stop, archive, pull, start and verify projects. -2. `methods/20-rclone.sh` — copy archives to an rclone destination when enabled. -3. `methods/30-smb.sh` — copy archives to a mounted SMB share when enabled. +2. `stages/20-rclone.sh` — copy archives to an rclone destination when enabled. +3. `stages/30-smb.sh` — copy archives to a mounted SMB share when enabled. 4. `stages/90-prune.sh` — retain the newest configured number of `.zst` archives locally, including legacy `.zst` and current `.tar.zst` names. @@ -38,7 +38,7 @@ cd /backupdockerscripts sudo cp .env.example .env sudo cp containers.txt containers.local.txt sudo chmod 600 .env -sudo chmod +x backup.sh docker-backup.sh dockerbackup_prune.sh stages/*.sh methods/*.sh +sudo chmod +x backup.sh stages/*.sh ``` Edit `.env`. Beaver's Docker source is already represented by: @@ -127,8 +127,8 @@ Run individual parts: ```bash sudo stages/10-containers.sh --dry-run -sudo methods/20-rclone.sh --dry-run --force -sudo methods/30-smb.sh --dry-run --force +sudo stages/20-rclone.sh --dry-run --force +sudo stages/30-smb.sh --dry-run --force sudo stages/90-prune.sh --dry-run ``` @@ -179,8 +179,8 @@ pipeline lock prevents concurrent runs. ## Adding another backup method -Add an executable script named `methods/NN-name.sh`, for example -`methods/40-restic.sh`. It should load `lib/common.sh`, accept `--dry-run`, and +Add an executable script named `stages/NN-name.sh`, for example +`stages/40-restic.sh`. It should load `lib/common.sh`, accept `--dry-run`, and return a non-zero status on failure. Add its short name to `.env`: ```bash diff --git a/backup.sh b/backup.sh index 0f47676..3f58b17 100755 --- a/backup.sh +++ b/backup.sh @@ -10,7 +10,7 @@ while [[ $# -gt 0 ]]; do --containers|-f) CONTAINERS_OVERRIDE="${2:?Missing containers file}"; shift ;; -h|--help) echo "Usage: ${0##*/} [--dry-run] [--containers FILE] [--skip-containers] [--skip-prune]" - echo "Methods run in BACKUP_METHODS order. Add methods/NN-name.sh and list name in BACKUP_METHODS." + echo "Transfer stages run in BACKUP_METHODS order. Add stages/NN-name.sh and list name in BACKUP_METHODS." exit 0 ;; *) die "Unknown option: $1" 2 ;; esac @@ -59,7 +59,7 @@ fi method_args=(); (( DRY_RUN )) && method_args+=(--dry-run) for method in $BACKUP_METHODS; do method_script="" - while IFS= read -r candidate; do method_script="$candidate"; break; done < <(find "$SCRIPT_DIR/methods" -maxdepth 1 -type f -name "*-${method}.sh" -print | sort) + while IFS= read -r candidate; do method_script="$candidate"; break; done < <(find "$SCRIPT_DIR/stages" -maxdepth 1 -type f -name "*-${method}.sh" -print | sort) [[ -n "$method_script" ]] || die "Configured backup method not found: $method" "$method_script" "${method_args[@]}" done diff --git a/methods/20-rclone.sh b/stages/20-rclone.sh similarity index 100% rename from methods/20-rclone.sh rename to stages/20-rclone.sh diff --git a/methods/30-smb.sh b/stages/30-smb.sh similarity index 100% rename from methods/30-smb.sh rename to stages/30-smb.sh