Here's a shell script to do the transfer of ssh with rsync. If you need help
with it hit me up.
Code:
#!/bin/bash
#
# Hans Waasdorp : [email protected]
#
# rsync transfer script
# script can also run from cron to sync content over multiple servers
# it only updates files that have been changed since the last run, will
# preserve permissions and ownership. It will remove files that are no
# no longer available on the source server.
source /root/.bashrc
# Path we want to transfer
SOURCE="/www/"
# Path where we want to store the transfer
DESTINATION="[email protected]:/www/"
# Debug for verbose transfer stats
DEBUG=0
# Testrun if set to 1 it will do a dry run without transferring anything
TESTRUN=0
LOCKFILE="/tmp/rsynch.lock"
# any stuff you don't want to transfer
EXCLUDEPATTERNS="--exclude=*.log"
if [ "x$DEBUG" == "x1" ]; then
OPTIONS="--stats --progress"
fi
if [ "x$TESTRUN" == "x1" ]; then
OPTIONS="-n --stats --progress"
fi
if [ ! -f $LOCKFILE ]; then
touch $LOCKFILE
trap 'rm -f ${LOCKFILE} >/dev/null 2>&1' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
rsync -e "ssh -i /root/.ssh/id_dsa" -u -aH $EXCLUDEPATTERNS --delete --force --partial $OPTIONS $SOURCE $DESTINATION
else
exit 1
fi