Last active
November 7, 2018 09:44
-
-
Save datawookie/64cd6de0bee63de6f5100cc15f7faac5 to your computer and use it in GitHub Desktop.
Created a dated version of a file and persist on S3.
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 | |
# Created a dated version of a file and persist on S3. | |
# | |
# Usage: | |
# | |
# dated-backup.sh file-to-backup.txt s3://name-of-bucket/ | |
FILE=$1 | |
BUCKET=$2 | |
BACKUP=$(dirname $FILE)/$(date +%Y%m%d-%H%M)-$(basename $FILE).bz2 | |
bzip2 -zc $FILE >$BACKUP | |
s3cmd put $BACKUP $BUCKET | |
rm $BACKUP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment