Auto-Update SVN on Media Temple (gs)
Tags: Media Temple, Linux | Written on 9/10/08

I wanted to update SVN every 5 minutes on my Media Temple grid service (gs) account. Here is the steps I took to make that happen.
First, I created a shell script with the SVN Update (I'll show how in a minute). I got this error:
Error validating server certificate
For some reason SVN wasn't reading my trusted server list, so I asked (mt) about it.

Josh Kline at Media Temple pointed out the issue. I'm not sure why this isn't documented somewhere, so I'm blogging it.
SVN looks for the config, including the trusted server list, in
$HOME/.subversion
Your cron jobs run withHOME=/home/#####, but when you ssh inHOME=/home/#####/users/.home
running svn with--config-dir /home/#####/users/.home/.subversionwill fix the problem.
That said, here are the steps to get SVN to auto update every 5 minutes. SSH in, you will have to go through the steps to enable SSH.
Bash:
cd data mkdir scripts vi cron.sh
In your cron.sh, use the config command that Josh suggested (replacing ##### with your id)
Bash:
svn update SVN_PATH --config-dir /home/#####/users/.home/.subversion
Go into the (mt) control panel under Cron Jobs and configure one to run your shell script.

There you have it, you now have svn auto updating on shared hosting.
Comments
travi: Shared hosts do not allow you to run hook scripts last I checked. I have covered writing hook scripts before, so yes I do know about them - thanks though.
REPOS="$1"
REV="$2"
REVP=$REV
REVP=$[REVP-=1]
SUBJECT="New (Insert repo name) commit r$REV: `svn log -r HEAD file://$REPOS | tail -n +4 | head -n 1`"
LOG="`svn log -r HEAD file://$REPOS | tail -n +5`"
DIFF="`svn diff file://$REPOS -r$REVP:$REV`"
echo "$LOG $DIFF" | mail email1@domain.com email2@domain.com -s "$SUBJECT"
I tried to get a post-commit auto update working but ran into trouble and didn't push too hard. Maybe with the info in your article here it can be done though.
REPOS="$1"
DOMAINS=/home/#####/domains/
SVN=/usr/bin/svn
SVNCONFIGDIR=/home/#####/users/.home/.subversion
DOMAIN=${REPOS:29}
UPDATEPATH=$DOMAINS$DOMAIN/
$SVN update $UPDATEPATH --config-dir $SVNCONFIGDIR
My script assumes you have your repositories in /home/#####/data/repositories/[DomainName]