I love using WordPress for this blog and that it keeps getting updates. The only problem is that installing the updates isn’t as simple as unzipping the archive and double clicking. Every time there is an update, I curse it as I have to re-read the instructions every time. Well, I finally decided to create a simple script to handle all this for me. The scripts assumes you have a backup of your database (I do this nightly, so that isn’t a problem) and that you’ve disabled all your plugins or are willing to risk things breaking. Old of my uploads, themes, and plugins live in wp-content and I don’t use multiple languages, so my script just seems to work. I’m sure someone has a better way or will point out a mistake. In any case, it was easy to put together and appears to work. Yeah, one command updates!
#!/bin/bash cd /var/www rm -rf /var/www/blog.tgz tar -czvf blog.tgz blog.gruby.com rm -rf /var/www/wordpress*.tar.gz wget http://wordpress.org/latest.tar.gz rm -rf /var/www/wordpress tar -xvzf wordpress*.tar.gz cp /var/www/blog.gruby.com/wp-config.php /var/www/wordpress/ cp -ur /var/www/blog.gruby.com/wp-content /var/www/wordpress/ cp /var/www/blog.gruby.com/.htaccess /var/www/wordpress/ chown -R apache.apache /var/www/wordpress/ rm -rf /var/www/blog.gruby.com.old mv /var/www/blog.gruby.com /var/www/blog.gruby.com.old mv /var/www/wordpress /var/www/blog.gruby.com rm -rf /var/www/wordpress*.tar.gz