Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Back up blog or FTP directory with AppleScript Internet
All those many different WordPress plugins to back up my blog looked too daunting to me, so I decided to create my own simple Mac-native solution using AppleScript. This AppleScript does the following:
  1. 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)
  2. Runs the handy Unix backup command rsync to copy the remote contents locally
  3. 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 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"
Set you own user name, domain and backup destination in the script.

[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.]
    •    
  • Currently 3.25 / 5
  You rated: 4 / 5 (4 votes cast)
 
[5,923 views]  

Back up blog or FTP directory with AppleScript | 3 comments | Create New Account
Click here to return to the 'Back up blog or FTP directory with AppleScript ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Back up blog or FTP directory with AppleScript
Authored by: uxjw on Apr 25, '12 04:56:08PM

The only problem with this method is the Wordpress database wouldn't be backed up, and it's often the only thing that changes daily. The files only change when you upload images or modify the theme.

BackWPup ( http://wordpress.org/extend/plugins/backwpup/ ) is the best Wordpress backup plugin I've found - files and database can be backed up and sent to email/ftp/dropbox/s3/etc on a schedule you set.



[ Reply to This | # ]
Back up blog or FTP directory with AppleScript
Authored by: kirkmc on Apr 26, '12 12:45:45AM

Which is exactly what I said in my comment on the hint. Though I use a different plug-in; I'll check out the one you mention to see if it's better.

---
Mac OS X Hints editor - Macworld senior contributor
http://www.mcelhearn.com



[ Reply to This | # ]
Back up blog or FTP directory with AppleScript
Authored by: lazybaer on Apr 26, '12 07:12:39AM

If the destination drive is on a server or another mac, be careful with permissions and if you want to save links (ln) you should change the options.



[ Reply to This | # ]