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
and moved it there
.
Using it
Unfortunately, to use it you have to specify the path (so …
). 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!
Chris said:
Hey Ben,
Just an FYI, but some WordPress upgrades also require a DB update as well. You can accomplish this by adding something like the following line to your script (assuming your website is benwatts.ca of course):
wget -q -O – http://benwatts.ca/wp-admin/upgrade.php?step=1> /dev/null
All the best,
-Chris
Chris said:
P.S. – The “>” should be a “less than” symbol!
Ben said:
Sweet! That’s good to know, thanks for that!