Create a gist now

Instantly share code, notes, and snippets.

@ozh /
Last active Jun 4, 2018

Bash script: update WordPress to latest

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

SITE=$(pwd | sed -e 's|/home/[^/]*/|http://|')
echo Updating Wordpress in $CURDIR
echo 1. downloading latest build
wget -q
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