Created
July 15, 2011 21:07
-
-
Save fzero/1085551 to your computer and use it in GitHub Desktop.
Update several self-hosted Wordpress blogs at once on Dreamhost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd $HOME | |
# Add here every domain/folder where you have Wordpress installed. | |
# Dreamhost normally puts all domains on $HOME, so this is what I do. | |
DOMAINS="mydomain1.com mydomain2.com mydomain3.com" | |
# Add here any dirs, file patterns etc. that you don't want to backup before upgrading. | |
# These are MY settings; tweak according to your needs. | |
cat << EOF > tar_exclusions | |
*.mp3 | |
*.ogg | |
*.alp | |
*.zip | |
EOF | |
mkdir -p backup | |
printf "\nUpdating Wordpress on all domains:\n\n" | |
printf "- Downloading the latest version of WP... " | |
wget -q -c http://wordpress.org/latest.tar.gz || exit 1 | |
printf "ok!\n\n" | |
for domain in $DOMAINS; do | |
printf "- Backing up $domain " | |
tar czf "backup/$domain-$(date +%F).tar.gz" \ | |
-X tar_exclusions \ | |
"$domain" || exit 1 | |
printf "ok!\n" | |
printf "- Updating $domain " | |
ln -s $domain wordpress && printf '. ' && \ | |
tar xzf latest.tar.gz && printf '. ' && \ | |
rm -f wordpress && printf '. ' && \ | |
printf "ok!\n\n" | |
done | |
rm -f latest.tar.gz tar_exclusions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment