Created
October 25, 2011 20:34
-
-
Save panupan/1314173 to your computer and use it in GitHub Desktop.
Mirror all Amazon S3 buckets with daily cron script using s3cmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BACKUP_DIR='/backups/S3 Mirror/' | |
BUCKETS=$(s3cmd ls | grep s3 | awk '{ print $3 }') | |
for i in $BUCKETS; do | |
CURRENT_DIR=$BACKUP_DIR${i//s3:\/\//}/ | |
echo Mirroring $i to $CURRENT_DIR | |
mkdir -p "$CURRENT_DIR" | |
s3cmd sync --verbose --no-check-md5 --recursive --no-delete-removed $i "$CURRENT_DIR" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment