Backing up Der Flounder
I’m very fortunate that WordPress.com’s hosting has provided me with a free way to blog without having to worry about anything besides “Is it up?” However, along with the question “Is it up?”, there’s the possibility that the answer someday may be “No”. The usual answer to this problem is “Set up an automated backup”, but I had the following technical issues to deal with:
- Backups can only be made manually via the admin console
- Backups made via the admin console would not include the hosted media (images, videos, etc)
- Media is linked at a separate address
- I do not have shell access to the server(s) hosting the blog (which would allow me to set up a normal WordPress backup)
Fortunately, there’s a relatively straightforward solution: mirror the site to a local backup using HTTrack. See below the jump for the details.
To set up an automated backup using HTTrack, I did the following:
1. Installed MacPorts
2. Installed HTTrack using the following command:
sudo port install httrack
3. Set up the following script as /etc/periodic/daily/810.der_flounder.backup
#!/bin/sh backupDirectoryPath="/Users/Shared/derflounder_backup" /opt/local/bin/httrack "https://derflounder.wordpress.com/" -O "$backupDirectoryPath" "+https://derflounder.wordpress.com/*" "+https://derflounder.files.wordpress.com/*" -v
For the script itself:
- I’m first specifying the starting point. In this case, it is “https://derflounder.wordpress.com/“.
- We can specify where the mirrored data will go using the -O flag (note that $backupDirectoryPath is a path I defined earlier on in my script. The backup data will be stored in /Users/Shared/derflounder_backup)
- The quotations where I have “+” with something are urls from which it is allowed to download, and process. If you do not specify any, it will only download from the domain you specify.
- The “-v” flag specifies httrack to run in verbose mode.
For the automation:
Storing the script in /etc/periodic/daily will ensure that periodic will run the script on a nightly basis. Files within the periodic directories are executed in alphabetical order, which is why the file is prefixed with a number.
The blog and its current posts are backed up on a nightly basis to one of my servers at home. From there, CrashPlan and the locally-attached Time Machine backup can both pick up the mirrored website directory and back it up.