Last active
January 16, 2019 02:23
-
-
Save datawookie/cec952f6350c269c724ef35b361d67bc to your computer and use it in GitHub Desktop.
Compress file and copy to 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 | |
# $ s3-backup data-file.txt s3://my-backup-folder | |
# | |
# Install under /usr/bin/ if it will be run from cron. | |
FILEPATH=$1 | |
FILENAME=`basename $FILEPATH` | |
FILEDATE=`date +%Y%m%d-%H%M`-$FILENAME | |
bzip2 -c $FILEPATH >$FILEDATE.bz2 | |
s3cmd put $FILEDATE.bz2 $2 | |
rm $FILEDATE.bz2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment