Twitter Facebook Pinterest Google+ Stumbleupon LinkedIn
With WordPress being updated more frequently than ever with new security fixes and features it’s important to keep you site up to date with the lates version of WordPress.
Running one update is easy and quick enough but if you have a dozen or more WordPress sites on one server you can update them all at once with a very simple bash script.
This script can be used in one of two ways:
1: Setup the script and run it every time a new version of Wordpres is released
2: Setup a cron task to run the update weekly, this will mean you never have to worry about out of date versions of WP ever again.
It works by using wget to download the latest version and unzip it’s files to each of your WordPress installs.
#!/bin/bash wget -q http://wordpress.org/latest.tar.gz -O /var/www/latest.tar.gz; tar -C /var/www/ -zxf /var/www/latest.tar.gz; cp -r /var/www/wordpress/* /var/www/example.com/htdocs; cp -r /var/www/wordpress/* /var/www/example.co.uk/htdocs; cp -r /var/www/wordpress/* /var/www/test.com/htdocs;
Note: If all the sites on your server are running WordPress you could replace the individual cp lines with a loop to go through folders but to keep it simple and stop errors I’ve put a line in for each WP site.
Posted by Adi on April 1, 2013
Leave a Reply