I upgraded my blog from WordPress 2.6.3 to 2.7.1 earlier this evening. It was simple and quick:
- unpacked the 2.7.1 kit into a scratch directory
- backed up my current installation (see the “pull” script below)
- copied (and updated) my original .htaccess and wp-config.php files into the scratch tree
- deactivated all my plugins
- rsync‘d the scratch tree on top of my remote blog tree
- re-enabled my plugins
- checked settings and hit various links to make sure the code and theme were behaving
If you’ve modified the WordPress code, you’ll have to re-apply your changes to the new code of course. Because the only significant changes I’ve made are to my theme, I didn’t have to do that. For those interested, here are the scripts I used (be careful with cut-n-paste: it willscrew up the various kinds of quotes):
The actual update transfer is a single command:
-
$ rsync -e ssh -avP ./scratchdir/ me@remote.host.com:path/to/blog/
I made the backup using this “pull” script, which makes a complete backup (via rsync) of my remote account to my laptop. That’s the entire account, not just the blog directory tree. I also make a nightly backup of the blog’s database on the remote host, so that’s included as well. Here’s the script, which I run ad hoc every day or so, when it’s convenient:
-
#!/bin/bash
-
-
REMOTE_BASE=me@remote.host.com:/home/me
-
LOCAL_BASE=$HOME/sites/myisp/me
-
-
# EXCLUDE1=/logs/
-
EXCLUDE2=/Maildir/
-
EXCLUDE3=/tmp/
-
-
# NOTE: trailing slashes on bases
-
rsync -e ssh -azvP \
-
–exclude=$EXCLUDE2 –exclude=$EXCLUDE3 \
-
$REMOTE_BASE/ \
-
$LOCAL_BASE/
-
-
date >$LOCAL_BASE/pull-from-myisp.date
-
-
# end
Here’s the MySQL backup script, run nightly via cron. By including the weekday name, I have a rotating backup of the last seven days:
-
#!/bin/bash
-
# @(#) $Id$
-
-
DBNAME=<<MYDBNAME>>
-
DBHOST=<<MYSQLHOST>>
-
DBPASS=<<HAHAHA>>
-
-
BCKDIR=$HOME/backups/mysql
-
BCKFILE="$DBNAME-`date +%a`.sql"
-
-
uptime
-
-
[ ! -d $BCKDIR ] && mkdir -p $BCKDIR
-
-
echo "`date` : starting backup"
-
-
# I don't have RELOAD privs, so can't use
-
# –flush-logs
-
# –lock-all-tables
-
-
mysqldump > $BCKDIR/$BCKFILE \
-
–host=$DBHOST \
-
–opt \
-
–allow-keywords \
-
–comments \
-
–create-options \
-
–disable-keys \
-
–password=$DBPASS \
-
$DBNAME
-
-
echo "`date` : completed"
-
-
chmod u=rw,g=r,o= $BCKDIR/$BCKFILE
-
ls -lh $BCKDIR/$BCKFILE
-
-
uptime
-
-
# end
Feel free to comment here or email me if you have any suggestions or questions.