Apr 25, '12 07:30:00AM • Contributed by: lucaslivingston
- Simulates a double-click on the alias to my web server (where my WordPress blog lives) to mount it as a WebDAV volume (just like iDisk)
- Runs the handy Unix backup command rsync to copy the remote contents locally
- Unmounts my web server
I then set up a daily iCal event to run the script at 4 a.m. Since I already have CrashPlan backing up my hard drive, that takes care of archiving periodic versions of the backup, just in case.
Here's the script:
Set you own user name, domain and backup destination in the script.
set filepath to "Macintosh HD:Users:USERNAME:Library:Favorites:www.example.com" tell application "Finder" to open filepath delay 30 do shell script "rsync -av /Volumes/www.example.com/blog/ '/Volumes/Backup/wordpress-backup'" tell application "Finder" to eject "www.example.com"
[kirkmc adds: While this is a simple solution, I think it's good to remind people how easy it is to back up a server with rsync. While the submission mentions WordPress blogs, this can be used for any server directory. It's worth reading an older hint about using rsync for backups and a much older (from 2003) detailed walkthrough of creating backups using rsync.
It's also worth pointing out that while there are many WordPress backup plug-ins available, it is also a good idea to use one. The backup in this hint only backs up files, not the actual WordPress database. I use the WP-DBManager plug-in for automatic backups of my database, that are sent to me by e-mail.]