use subversion to publish websites

Sometimes I'm really surprised about myself... especially how lazy I am. :-)

I'm currently playing around with one of my private websites, and to improve developing I decided to use subversion. So far so good, but I wanted that the committed subversion code was automatically online on the webserver. So I did the following very simple trick.

First I check out the code (subtree) from the subversion server (which is using https):

$ cd /sites
$ mv{,-backup}
$ svn co

Next step was to commit the current content of the website into subversion:

$ cd /sites/
$ cp -Rv /sites/*  ./
$ svn add *
$ svn commit -m "Initial commit of dev env"

Now download the simple script I created for making sure that subversion doesn't fire off twice for updating the same tree.

Download via this link.

So something like this:

$ mkdir ~/scripts/
$ cd ~/scripts
$ wget
$ chmod 700

Now... the last step... create a crontab entry with the following content:

*/1 * * * * /home/pieter/scripts/ /sites/ 2>&1 > /dev/null

 And guess... and it works like a charm, on every new commit done by whoever... you get your online site updated within 1 minute without the need log in into the website/webserver using ftp/ssh/whatever.