Skip to content

Commit 47df54e

Browse files
Merge pull request #224 from jthiltges/pr/s3-backup-remove
s3-backup: Add optional --dry-run argument, passed through to mc mirror
2 parents 184b60d + ae5ea3a commit 47df54e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

opensciencegrid/s3-backup/s3-backup.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ Subcommands:
2323
backup Encrypts and backs up data to S3
2424
ls [path] Show contents of S3_DEST_DIR or 'path'
2525
('/' shows the contents of the S3_BUCKET root)
26-
mirror [--remove] Sync S3 source to S3 destination, replacing contents
27-
--remove: Remove extraneous objects from target
26+
mirror Sync S3 source to S3 destination, replacing contents
27+
[--remove] Remove objects on dest that do not exist on source
28+
[--dry-run] Perform a mock mirror operation
2829
restore [datetime] Restore latest backup from S3 or backup corresponding to
2930
'datetime' (format YYYYMMDD-hhmm)
3031
@@ -135,6 +136,8 @@ mc_mirror() {
135136
# Parse optional args
136137
while [[ $# -gt 0 ]]; do
137138
case $1 in
139+
--dry-run)
140+
shift; args+=("--dry-run") ;;
138141
--remove)
139142
shift; args+=("--remove") ;;
140143
*)
@@ -169,8 +172,8 @@ mc_create_alias () {
169172
# Capture the subcommand
170173
case $# in
171174
0) subcommand=backup ;;
172-
# allow 2 args, ls/restore can take an additional arg
173-
[12]) subcommand=$1 ;;
175+
# allow 2-3 args, ls/restore can take 2, mirror 3
176+
[123]) subcommand=$1 ;;
174177
*) usage ;;
175178
esac
176179

0 commit comments

Comments
 (0)