Skip to content

Instantly share code, notes, and snippets.

@datawookie
Last active November 7, 2018 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save datawookie/64cd6de0bee63de6f5100cc15f7faac5 to your computer and use it in GitHub Desktop.
Save datawookie/64cd6de0bee63de6f5100cc15f7faac5 to your computer and use it in GitHub Desktop.
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