#!/bin/bash

# Usage: sync.sh (-p|-s) (live|stage)

# Author: Bryan Petty
# Date: February 7, 2008

LIVE="user@www.domain.com:/var/www/www.domain.com"
STAGE="user@stage.domain.com:/var/www/stage.domain.com"
SRC="../www/"

OPTIONS="--del --exclude .svn --exclude *.swp"

RSH="ssh"

case $1 in
	-p)	COMMAND="rsync -rltDni" ;;
	-s)	COMMAND="rsync -rltDi" ;;
	*)	echo "Please specify either '-p' (pretend / dry run) or '-s' (sync)."
		exit ;;
esac

case $2 in
	live)	$COMMAND $OPTIONS --rsh="$RSH" $SRC $LIVE ;;
	stage)	$COMMAND $OPTIONS --rsh="$RSH" $SRC $STAGE ;;
	*)	echo "Please select either 'live' or 'stage' sync destination."
		exit ;;
esac



