Skip to content

Instantly share code, notes, and snippets.

@ozh
Last active April 14, 2024 22:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ozh/4260740 to your computer and use it in GitHub Desktop.
Save ozh/4260740 to your computer and use it in GitHub Desktop.
Bash script: update WordPress to latest

Works with Dreamhost's hosting style: directories in ~ like /home/joe/blog.joe.com/

#!/bin/bash
CURDIR=$(pwd)
SITE=$(pwd | sed -e 's|/home/[^/]*/|http://|')
echo Updating Wordpress in $CURDIR
echo 1. downloading latest build
wget -q http://wordpress.org/latest.tar.gz
echo 2. unpacking latest build
tar zxf latest.tar.gz
cd wordpress/
echo 3. replacing old files with fresh ones
tar cf - . | (cd $CURDIR; tar xf -)
echo 4. updating your blog
wget -q -O - ${SITE}/wp-admin/upgrade.php?step=1 > /dev/null
echo 5. removing unneeded files and directory
cd ..
rm -f latest.tar.gz
rm -rf wordpress/
echo 6. all done !
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment