Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Created a dated version of a file and persist on S3.
#!/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