My Wordpress Upgrade Bash Script
I’m not a UNIX guru, so I can’t really memorize all commands. When upgrading my Wordpress version, I only run four lines of commands, but I can’t remember the parameters. Today, I was in the mood to write a simple bash shell script so that next time all I have to do to upgrade my site are: backup, run the script, relax… The script does not backup data and design files. If you are to use the code, make sure to backup before running the script. Check out Wordpress for backup solutions.
#!/bin/bash
#
# Wordpress Upgrade Script
# Author: Alfonso Varon
#
# PRECONDITION: Data & design backup should have been done.
#
echo "Warning!!! Backup design files and data before proceeding..."
echo -e "\n"
echo -e "Let's begin...\n"
echo -n "Which site would you like to update ([1]=arot, [2]=sol): ”
read -e SITE
setterm -background $SITE
if [ $SITE -eq 1 ] # upgrade ARoT
then
echo “Changing to A Record of Thoughts directory…”
cd ~/public_html
elif [ $SITE -eq 2 ] # upgrade SoL
then echo “Changing to Sapian Online’s directory…”
cd ~/public_html/xxx
fi
echo -e “We are currently in directory:”
pwd
echo -e “\n”
echo -e “Downloading the latest version of Wordpress…”
wget http://wordpress.org/latest.tar.gz
echo -e “Done.”
echo -e “Unzipping the package…”
tar -xzvf latest.tar.gz
echo -e “Done.”
echo -e “Upgrading…”
cp -rpf –reply=yes wordpress/* ./
echo -e “Done.”
echo -e “Cleaning…”
rm -rf ./wordpress
rm latest.tar.gz
echo -e “Done.\n”
echo -e “Wordpress files have been upgraded. Go to the administration
panel for further upgrade instructions.”
Add comment April 5th, 2008

