#!/bin/bash

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

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

LIVE="root@phoenixcpm.com:/var/www/phoenixcpm"
STAGE="root@gozer:/var/www/stage.phoenixcpm.com"
SRC="../www/"

OPTIONS="--del --exclude .svn --exclude *.swp"
OPTIONS="${OPTIONS} --exclude sendstudio-*/admin/temp/*"
OPTIONS="${OPTIONS} --exclude tmp/templates_c/*"

RSH="ssh -p2635"

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


