[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Minimal Rsync Idea



I've augmented the anonftpsync script so that a minimal rsync is done on the project/trace/ directory to see if a "real" rsync is needed. The relevant addition is:

# check if we need to sync
if [[ "$TRACE_HOST" != "" ]]; then
   TRACE_FILE=$TO/project/trace/${TRACE_HOST}
   TRACE_PRE_DATE=`ls -al $TRACE_FILE`
   rsync --times --verbose \
       $RSYNC_HOST::$RSYNC_DIR/project/trace/ \
       $TO/project/trace/ >> $LOGFILE 2>&1
   TRACE_POST_DATE=`ls -al $TRACE_FILE`
   if [ "$TRACE_PRE_DATE" = "$TRACE_POST_DATE" ]; then
       LANG=C date -u > "${TO}/project/trace/${HOSTNAME}"
       echo 'Trace file for' $RSYNC_HOST::$RSYNC_DIR \
           'unchanged, not rsyncing.' >> $LOGFILE
       exit 0
   fi
fi

I've added this right before the first rsync. TRACE_HOST should be set to ftp-master.debian.org for the Debian repository. This seems like a reasonable alternative to push mirroring and this check has minimal impact on the remote server.



Reply to: