Created
May 3, 2013 16:03
-
-
Save yourdesigncoza/5510387 to your computer and use it in GitHub Desktop.
Recovering a WordPress site thats been compromised is not fun, where to find all those images etc. etc. The solution, run a daily BackUp of the whole wp-content folder, then you have everything to restore your site ::: However if you backup your site every day this can drain your server resources if you have thousands of images ( remember each i…
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
# Recovering a WordPress site thats been compromised is not fun, where to find all those images etc. etc. The solution, run a daily BackUp of the whole wp-content folder, then you have everything to restore your site ::: However if you backup your site every day this can drain your server resources if you have thousands of images ( remember each image in WP is duplicated AT LEAST 3 times ), imagine your BU running while you have a reasonable traffic ::: | |
# My solution is as follows ::: I used rsync which has a function that compares files then only adds new files/folders also removing files/folders not needed any more ::: I also wanted a 7 day backup solution, so what I do is I create a file each day "Uniquely Stamped" with each day eg. Monday is 01, Tuesday 02 you get the picture ::: Once we move on to the eight day we will be back where we started day 01 ( if BU's commenced on a Monday ) , on day 8, what will happen is that only files/folders added or deleted will be added and removed from the BU created a week ago ::: | |
# resources | |
# http://www.jveweb.net/en/archives/2010/11/synchronizing-folders-with-rsync.html#jveweb_en_014_05 | |
# https://help.ubuntu.com/community/rsync | |
# IMPORTANT : add your own data or parameters, I make use of double segments [[ your variable ]]. eg. ssh root@[[ 96.172.44.11 ]] should be replaced with ssh [email protected] where "888.88.88.88" is your value, variable etc. I have a habit of using ":::" to indicate line ending and end of paragraph, crazy I know but be warned its just how I write ::: All notes are for my own use & should you use any it's at your own risk, it's NOT a Tutorial ::: | |
### Start Script | |
#!/bin/sh | |
#################################### | |
# | |
# Backup Typical Wordpress Folders. | |
# | |
#################################### | |
BackUpDIR="/var/wrdp-bu/content"; | |
BackUpThis="/var/www/wp-content"; | |
# Format day eg. 1 | |
day_stamp=$(date +%u); | |
# Use RSYNC to backup | |
rsync --recursive --delete -az $BackUpThis $BackUpDIR/wp-content_$day_stamp; | |
### End Script | |
# Example Cron Schedule | |
# Backup WP-Content @ 12:00 AM | |
# @daily bash /var/yourfile/bu-wp-content.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment