Last active
August 29, 2015 14:02
-
-
Save robjshaw/845bbee579aa09db666d to your computer and use it in GitHub Desktop.
simple backup script for webroot -> s3 backup
This file contains hidden or 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 | |
| NOW=$(date +"%m-%d-%Y") | |
| file="$NOW.appname.tar.gz" | |
| sourcedir='/var/www/appname/public_html' | |
| bucketname="s3://bucketname/$file" | |
| echo "backing up $sourcedir to /tmp/$file & then to s3 bucket $bucketname" | |
| tar -zcvf /tmp/$file $sourcedir | |
| echo 'all backed up now s3 move' | |
| aws s3 cp /tmp/$file $bucketname | |
| echo "now deleting backup file /tmp/$file" | |
| sudo rm /tmp/$file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment