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

Re: occasional error on ftp.cz.debian.org



Josip Rodin un jour écrivit:

You can optimize that further, by doing a two stage sync.
More exactly, like this:

  rsync --recursive --times --links --hard-links \
        --exclude "Packages*" --exclude "Sources*" \
        --exclude "Release*" --exclude "ls-lR*" \
        --verbose --stats \
        $FROM $TO > $LOGFILE 2>&1

  rsync --recursive --times --links --hard-links --max-delete=40000 \
        --delete --delete-after \
        --exclude "Archive-Update-in-Progress-${HOSTNAME}" \
        --exclude "project/trace/${HOSTNAME}" \
        --verbose --stats \
        $FROM $TO > $LOGFILE.2nd 2>&1
  cat $LOGFILE.2nd >> $LOGFILE
  rm $LOGFILE.2nd

  Replace the last line for:

          $FROM $TO >> $LOGFILE 2>&1

That will make the next 2 lines useless and avoid losing logfile.2nd if the script is terminated before the end or if the script is run a second time in parallel (the command 'lockfile' in the script will not prevent it in some special circumstences).

Simon Valiquette
http://gulus.USherbrooke.ca



Reply to: