rsync example

  bash, linux
#!/bin/sh
LOG=/tmp/syncSvn.log
SOURCE=/home/svn/dev/
DESTINATION=/mnt/d3/myd3/home/svn/dev
EMAIL=root@localhost
START=$(date +%s)
echo "" > $LOG
echo "Start " >> $LOG
echo `date` >> $LOG
echo "Now beginning sync $SOURCE to $DESTINATION " >> $LOG
rsync --verbose --archive --recursive --delete-during --human-readable --progress --itemize-changes $SOURCE $DESTINATION >> $LOG
echo "Finished sync $SOURCE to $DESTINATION " >> $LOG

echo "Checking SOURCE $SOURCE ..." >> $LOG
echo "----------------------------------------------" >> $LOG
df -h $SOURCE >> $LOG
echo "----------------------------------------------" >> $LOG
echo "Checking DESTINATION $DESTINATION ..." >> $LOG
echo "----------------------------------------------" >> $LOG
df -h $DESTINATION >> $LOG
echo "----------------------------------------------" >> $LOG
echo "Bye." >> $LOG
END=$(date +%s)
DIFF=$(( $END - $START ))
echo "I have ran the syncSvn script and it took $DIFF seconds" >> $LOG
echo "\nEnd " >> $LOG
echo `date` >> $LOG
cat $LOG |  mail -s "Gamma: sync $SOURCE to $DESTINATION " $EMAIL