SVN – Commit emails with sSMTP

Simple bash shell script to run in conjunction with sSMTP. Save as post-commit, svn will run after any commit.

#!/bin/bash
#
# This is a custom post-commit for sending email
# when an svn repo is changed.
#

repodir=$1
revision=$2

author=`/usr/bin/svnlook author  -r $revision $repodir`
date=`/usr/bin/svnlook   date    -r $revision $repodir`
log=`/usr/bin/svnlook    log     -r $revision $repodir`
info=`/usr/bin/svnlook   changed -r $revision $repodir`
url=”http://www.mydomain.co.uk/svn/filesystem/$repo”

ssmtp mydistrogroup@googlemail.com <<EOF
To: Dev Team
From: svn@mydomain.net
Subject: SVN Commit

repository  –  $url
date        –  $date
username    –  $author
revision    –  $revision
comment     –  $log

$info
EOF

Monitor Ubuntu Server with Munin