From f16a290a06d404722d53f6b38e567e340f9d7387 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 25 Jun 2010 21:52:38 +0200 Subject: make sync more atomic --- syncrepo | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/syncrepo b/syncrepo index f8975ff..e851c0b 100755 --- a/syncrepo +++ b/syncrepo @@ -2,24 +2,21 @@ home="$(dirname "${0}")" target="${home}/repo" +tmp="${home}/tmp" lock='/tmp/mirrorsync.lck' source='-e ssh gerolde.archlinux.org:/srv/ftp' repos='core,extra,testing,community,community-testing' -[ ! -d "${target}" ] && exit 1 +[ ! -d "${target}" ] && mkdir -p "${target}" +[ ! -d "${tmp}" ] && mkdir -p "${tmp}" [ -f "${lock}" ] && exit 1 touch "${lock}" trap "rm -f '${lock}'" EXIT INT TERM -rsync -rptlv --safe-links --delete --progress -h \ - --include='*/' \ - --include='*.db.tar.gz' \ - --exclude='*' \ - ${source}/{${repos}} \ - "${target}" - -rsync -rptlv --safe-links --delete --progress -h \ - --exclude='*.db.tar.gz*' \ +rsync -rtlvH --safe-links --delete-after --progress -h \ + --partial \ + --partial-dir="${tmp}" \ + --delay-updates \ --exclude='*.abs.tar.gz*' \ --exclude='*.files.tar.gz*' \ --exclude='*.links.tar.gz*' \ -- cgit v1.2.3-24-g4f1b