Consolidate pipeline scripts under stages
This commit is contained in:
1 parent
bd95f57b6e
commit
cef7a4ac7b
4 files changed
+9
-9
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user