#! /bin/bash
# sfwebcron

# To update the developers-guidelines.html and put in html area
#
# Install in cron with something like:
#  47 7 * * * $HOME/bin/sfwebcron

function die { echo $1; exit 1; }

# Set working variables
PROJECT=nagiosplug
IN=${HOME}/tmp_sfwebcron
OUT_SERVER="tonvoon@shell.sf.net"
OUT="/home/groups/n/na/nagiosplug/htdocs"

if [[ ! -e developer-guidelines.html.last ]] ; then
	touch developer-guidelines.html.last
fi

# Get latest dev guildelines
[[ ! -d $IN ]] && mkdir $IN
cd $IN
if [[ ! -d doc ]] ; then
	#cvs -z3 -d:pserver:anonymous@cvs1:/cvsroot/nagiosplug co nagiosplug || die "Cannot cvs"
	svn checkout http://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk/doc doc
fi
cd doc
svn update

make
if [[ developer-guidelines.html -nt developer-guidelines.html.last ]] ; then
	scp developer-guidelines.{html,sgml} $OUT_SERVER:$OUT
	touch developer-guidelines.html.last
fi