Skip to content

Instantly share code, notes, and snippets.

@tiernano
Created September 6, 2009 22:33
Show Gist options
  • Save tiernano/182027 to your computer and use it in GitHub Desktop.
Save tiernano/182027 to your computer and use it in GitHub Desktop.
Quick and Dirty Backup and Uploader for WorkPress Files
#!/bin/bash
# directory structure:
# ~/s3sync has scripts
# ~/s3sync/s3backup is a folder for temp backup files
cd /home/tiernano
BUCKET=<BucketName>
BlogDBNAME=wordpress
DBPWD=<EnterPasswordHere>
DBUSER=<EnterDBUserNameHere>
NOW=$(date +_%b_%d_%y)
tar czvf httpdocs_blog_backup$NOW.tar.gz <Wordpress Files Location>
mv httpdocs_blog_backup$NOW.tar.gz s3sync/s3backup
cd s3sync/s3backup
touch $BlogDBNAME.backup$NOW.sql.gz
mysqldump -u $DBUSER -p$DBPWD $BlogDBNAME | gzip -9 > $BlogDBNAME.backup$NOW.sql.gz
tar czvf Blog_backup$NOW.tar.gz $BlogDBNAME.backup$NOW.sql.gz httpdocs_blog_backup$NOW.tar.gz
rm -f $BlogDBNAME.backup$NOW.sql.gz httpdocs_blog_backup$NOW.tar.gz
ruby <s3SyncDir>/s3sync.rb -r --ssl --progress -v s3backup/ $BUCKET:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment