X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=scripts%2Fdebian%2Fsync-dd;h=857c68d1f9ccf69c4075bd9a9a020784b715bbad;hb=789b6808c823298e5bc56d8de61e1c13bb410382;hp=002cd46e31fc647b4e89b6c4624e926582606996;hpb=0adba148b67b4e310f87b65c316ae62a24ed6053;p=dak.git diff --git a/scripts/debian/sync-dd b/scripts/debian/sync-dd index 002cd46e..857c68d1 100755 --- a/scripts/debian/sync-dd +++ b/scripts/debian/sync-dd @@ -27,16 +27,17 @@ export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars . $SCRIPTVARS usage() { - echo "usage: $0 sync|pool" - echo - echo "sync dd-accessible copy of the archive" - echo - echo "arguments:" - echo " lock: file used for locking" - echo " host1: hostname for syncing /srv/ftp-master.debian.org" - echo " host2: hostname for syncing /srv/ftp.debian.org" - echo " sync|pool: sync excludes ftp/, pool syncs ftp/ too" - exit ${1:-0} + echo "usage: $0 sync|code" + echo + echo "sync dd-accessible copy of the archive" + echo + echo "arguments:" + echo " lock: file used for locking" + echo " host1: hostname for syncing /srv/ftp-master.debian.org" + echo " host2: hostname for syncing /srv/ftp.debian.org" + echo " sync|code: sync syncs everything" + echo " code only syncs the dak/ directory (uses host1 value as target)" + exit ${1:-0} } if [ $# -ne 4 ]; then @@ -51,61 +52,72 @@ mode="${4}" # extra options for rsync of /srv/ftp-master.debian.org extra1="" -case "${mode}" in - pool|sync) - ;; - *) - echo "Unknown mode ${mode}." >&2 - exit 1 - ;; -esac - cleanup() { - rm -f "${lockfile}" + rm -f "${lockfile}" } trap cleanup EXIT TERM HUP INT QUIT # Also, NEVER use --delete-excluded! -if lockfile -r3 "${lockfile}"; then - rsync -aH -B8192 \ - ${extra1} \ - --exclude "/.nobackup" \ - --exclude "/backup/*.xz" \ - --exclude "/backup/dump*" \ - --exclude "/build-queues/" \ - --exclude "/database/*.db" \ - --exclude ".da-backup.trace" \ - --exclude "/ftp" \ - --exclude "lost+found" \ - --exclude "/lock/" \ - --exclude "/mirror" \ - --exclude "/morgue/" \ - --exclude "/queue/bts_version_track/" \ - --exclude "/queue/unchecked/" \ - --exclude "/s3kr1t" \ - --exclude "/scripts/s3kr1t" \ - --exclude "/tmp/" \ - --delete --delete-after \ - --timeout 3600 \ - -e 'ssh -o ConnectTimeout=30 -o SetupTimeout=30' \ - /srv/ftp-master.debian.org/ "${host1}:/srv/ftp-master.debian.org/" - # command for the remote side: - # command="rsync --server -lHogDtpre.iLsf -B8192 --timeout=3600 --delete-after . /srv/ftp-master.debian.org/" +if lockfile -r3 "${lockfile}" 2> /dev/null; then + case "${mode}" in + sync) + rsync -aH -B8192 \ + ${extra1} \ + --exclude "/.nobackup" \ + --exclude "/backup/*.xz" \ + --exclude "/backup/dump*" \ + --exclude "/build-queues/" \ + --exclude "/database/*.db" \ + --exclude ".da-backup.trace" \ + --exclude "/export/changelogs/tmp*/" \ + --exclude "/ftp" \ + --exclude "lost+found" \ + --exclude "/lock/" \ + --exclude "/mirror" \ + --exclude "/morgue/" \ + --exclude "/queue/bts_version_track/" \ + --exclude "/queue/unchecked/" \ + --exclude "/s3kr1t" \ + --exclude "/scripts/s3kr1t" \ + --exclude "/tmp/" \ + --exclude "/public/incoming.debian.org" \ + --delete --delete-after \ + --timeout 3600 \ + -e 'ssh -o ConnectTimeout=30 -o SetupTimeout=30' \ + /srv/ftp-master.debian.org/ "${host1}:/srv/ftp-master.debian.org/" + # command for the remote side: + # command="rsync --server -lHogDtpre.iLsf -B8192 --timeout=3600 --delete-after . /srv/ftp-master.debian.org/" - rsync -aH -B8192 \ - --exclude "/.nobackup" \ - --exclude mirror \ - --exclude rsync/ \ - --exclude lost+found \ - --exclude .da-backup.trace \ - --exclude web-users/ \ - --delete --delete-after \ - --timeout 3600 \ - -e 'ssh -o ConnectTimeout=30 -o SetupTimeout=30' \ - /srv/ftp.debian.org/ "${host2}:/srv/ftp.debian.org/" - # command for the remote side: - # command="rsync --server -lHogDtpre.iLsf -B8192 --timeout=3600 --delete-after . /srv/ftp.debian.org/" + rsync -aH -B8192 \ + --exclude "/.nobackup" \ + --exclude mirror \ + --exclude rsync/ \ + --exclude lost+found \ + --exclude .da-backup.trace \ + --exclude web-users/ \ + --delete --delete-after \ + --timeout 3600 \ + -e 'ssh -o ConnectTimeout=30 -o SetupTimeout=30' \ + /srv/ftp.debian.org/ "${host2}:/srv/ftp.debian.org/" + # command for the remote side: + # command="rsync --server -lHogDtpre.iLsf -B8192 --timeout=3600 --delete-after . /srv/ftp.debian.org/" + ;; + code) + rsync -aH -B8192 \ + --exclude "/.nobackup" \ + --delete --delete-after \ + --timeout 3600 \ + -e 'ssh -o ConnectTimeout=30 -o SetupTimeout=30' \ + /srv/ftp-master.debian.org/dak/ "${host1}:/srv/ftp-master.debian.org/dak/" + # command for the remote side: + # command="rsync --server -lHogDtpre.iLsf -B8192 --timeout=3600 --delete-after . /srv/ftp-master.debian.org/dak/" + ;; + *) + echo "Unknown mode ${mode}." >&2 + exit 1 + ;; + esac else - echo "Couldn't get the lock, not syncing" + #echo "Couldn't get the lock, not syncing" exit 0 fi