public
Last active

Bash script: update WordPress to latest

  • Download Gist
updatewp.md
Markdown

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

updatewp.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/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 !

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.