Skip to content

Instantly share code, notes, and snippets.

@robjshaw
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save robjshaw/845bbee579aa09db666d to your computer and use it in GitHub Desktop.

Select an option

Save robjshaw/845bbee579aa09db666d to your computer and use it in GitHub Desktop.
simple backup script for webroot -> s3 backup
#!/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