#!/bin/bashPATH="/bin:/usr/bin:/usr/ucb:/usr/sbin:/usr/local/bin"export PATHLOG=/oracle/rsync/sync.logSEM=/oracle/rsync/semSRC=/oracle/oraarchDEST=rsync://backup/arc/RSYNC='/usr/local/bin/rsync -t'[ -e $SEM/run ] && exit 1touch $SEM/runcd $SRCfor i in *.dbfdo #if success semaphore created, bypass this file if [ ! -e $SEM/$i ]; then echo `date`" Sync file "$i" ..." >> $LOG $RSYNC $i $DEST >> $LOG 2>&1 #if rsync exit code success - create success semaphore if [ $? -eq 0 ]; then echo "Success." >> $LOG touch $SEM/$i fi fidone#delete semaphore for last arclog, because it maybe writing at this time, will be resynced next timerm $SEM/`ls | sort | tail -1`cd $SEM#delete old semaforesfor i in *.dbfdo [ ! -e $SRC/$i ] && rm $idonerm $SEM/run