Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple bash script to update Wordpress
#!/bin/bash
# This work is licenced under the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License.
# To view a copy of this licence, visit http://creativecommons.org/licenses/by-sa/2.0/uk/ or send a letter
# to Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.
# So before you start, the script assumes the following:
# 1. you have some sort of SSH access
# 2. you are owner of your blog (in terms of computa permissions)
# 3. the blog folder is called 'blog' (if not, change all instances of the word 'blog' with whatever it's called)
# 4. the server has curl installed
# 5. the server has un/zip installed (if not, change the zip to use gnutar)
# 6. and that the only changes you've ever made to your wordpress blog are /wp-config.php and in /wp-content folder
# Also, if it goes tits up, I don't accept any responsibility, so use are your own risk!
cd ~/www/ahmednuaman.com/static/
rm -rf blog-orig
cp -R blog blog-orig
curl -O http://wordpress.org/latest.zip
unzip latest.zip
rm -rf wordpress/wp-content
cp -R blog/wp-con* wordpress
rm -rf blog
mv wordpress blog
rm -rf latest.zip
echo 'Done! If everything has gone to plan, please delete the blog-orig folder in your blog directory.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment