]> git.decadent.org.uk Git - dak.git/commitdiff
add the syncscript for ries. also call it hourly
authorJoerg Jaspert <joerg@debian.org>
Tue, 22 Mar 2011 13:09:49 +0000 (14:09 +0100)
committerJoerg Jaspert <joerg@debian.org>
Tue, 22 Mar 2011 13:09:49 +0000 (14:09 +0100)
Signed-off-by: Joerg Jaspert <joerg@debian.org>
config/debian/cron.hourly
config/homedir/syncdd.sh [new file with mode: 0755]

index 73ba6afc4c9a77eda342fb11e5242819c828eb93..c20f4d1da3add2861129c7904f9cd26d2c4fb81b 100755 (executable)
@@ -30,4 +30,7 @@ cat removals.822 >> removals-full.822
 $base/dak/tools/queue_rss.py -q $queuedir/new -o $webdir/rss/ -d $base/misc -l $base/log/
 $base/dak/tools/removals.pl $configdir/removalsrss.rc > $webdir/rss/removals.rss
 
+# Tell ries to sync its tree
+ssh -o Batchmode=yes -o ConnectTimeout=30 -o SetupTimeout=30 -2 -i ${base}/s3kr1t/pushddmirror dak@ries.debian.org sync
+
 $scriptsdir/generate-di
diff --git a/config/homedir/syncdd.sh b/config/homedir/syncdd.sh
new file mode 100755 (executable)
index 0000000..4321971
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Copyright (C) 2011 Joerg Jaspert <joerg@debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+set -e
+set -u
+set -E
+
+export LANG=C
+export LC_ALL=C
+
+export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
+. $SCRIPTVARS
+
+cleanup() {
+    rm -f "${HOME}/sync.lock"
+}
+trap cleanup EXIT TERM HUP INT QUIT
+
+# not using $lockdir as thats inside the rsync dir, and --delete would
+# kick the lock away. Yes we could exclude it, but wth bother?
+#
+# Also, NEVER use --delete-excluded!
+if lockfile -r3 ${HOME}/sync.lock; then
+    cd $base/
+    rsync -aH -B8192 \
+           --exclude backup/*.xz \
+           --exclude backup/dump* \
+           --exclude ftp/ \
+           --exclude mirror/ \
+           --exclude morgue/ \
+           --exclude=lost+found/ \
+           --exclude .da-backup.trace \
+           --delete \
+           --delete-after \
+           --timeout 3600 \
+           -e 'ssh -o ConnectTimeout=30 -o SetupTimeout=30' \
+           ftpmaster-sync:/srv/ftp-master.debian.org/ .
+
+    cd $public/
+    rsync -avH -B8192 \
+           --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' \
+           ftpmaster-sync2:/srv/ftp.debian.org/ .
+
+else
+    echo "Couldn't get the lock, not syncing"
+    exit 0
+fi
+
+
+## ftpmaster-sync is defined in .ssh/config as:
+# Host ftpmaster-sync
+#   Hostname franck.debian.org
+#   User dak
+#   IdentityFile ~dak/.ssh/syncftpmaster
+#   ForwardX11 no
+#   ForwardAgent no
+#   StrictHostKeyChecking yes
+#   PasswordAuthentication no
+#   BatchMode yes
+
+## ftpmaster-sync2 is the same, just a second ssh key