Auto-Update SVN Bash Script

I’ve got at least 4 installs of WordPress on my server and I have them all checked out from WordPress’ SVN repository because uploading WordPress files whenever there is an update is incredibly annoying.

I know this means I may be using unstable and unreliable code and all that, but so far I haven’t had much of an issue. Worst case scenario I have to do a server rollback or something.

But anyway, having something like 4 SVN WordPress Installs it’s become apparent that I need an easier solution to running svn update on all the directories.
SO I MADE A BASH SCRIPT.

The Script

#!/bin/bash
# Updates all of my wordpress installations at once ...

echo '--Updating benwatts.ca';
cd ~/benwatts.ca
svn update

#[..] repeat for the other installs

echo "Done and done.";

Storing the Script

Then I created a bin folder in my user folder

mkdir ~/bin

and moved it there

mv ~/updatewordpress ~/bin/updatewordpress

.

Using it

Unfortunately, to use it you have to specify the path (so …

cd ~/bin; ./updatewordpress

). That kind of sucks. Not a whole lot … but I wanted to be a bit adventurous and make it so that I just have to type ‘updatewordpress’ and it’ll go ahead and do it. As it turns out, at least in my version of linux it already searches ~/bin for shell scripts … so all I had to do was log out and log back in again and now the command is there … NICE!

3 comments

Leave a Reply

Your email address will not be published. Required fields are marked *