Updating Multiple WordPress Installations
March 19th, 2008 by Peter Glaeser |
RSS feed for comments on this post |
TrackBack URI
Many affiliates run multiple WordPress blogs on the same server. It’s necessary to update your installations regularly as WordPress is an extremely vulnerable piece of software. Manual updating costs too much time, so here’s some Linux shell code for you. My script assumes that the document root of all WordPress installations on that server is at /srv/www/htdocs/DOMAINNAME/wordpress.
1. We download the WordPress source code:
unlink source_en.zip
wget http://wordpress.org/latest.zip
mv latest.zip source_en.zip
2. We run backups of the old system, extract the new version and restore the old sitemap.
for domain in example.com anotherexample.com lastexample.com
do
rm -r /srv/www/htdocs/$domain/wordpress_old
cp -r /srv/www/htdocs/$domain/wordpress /srv/www/htdocs/$domain/wordpress_old
unzip source_en.zip -d /srv/www/htdocs/$domain
cp /srv/www/htdocs/$domain/wordpress_old/sitemap.xml /srv/www/htdocs/$domain/wordpress
done
You also want to keep your plugins updated. You will need to collect the sources from various sites on the internet and put the extracted versions in a “plugins” folder on your server. With the following script you can deploy the contents of your plugins folder (which you keep up to date manually) to all of your WordPress installations:
for domain in example.com anotherexample.com lastexample.com
do
rm -r /srv/www/htdocs/$domain/wordpress/wp-content/plugins
cp -r plugins /srv/www/htdocs/$domain/wordpress/wp-content
done
Good luck and happy blogging.

1 Trackback(s)