summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2015-08-11 19:59:30 +0200
committerFabian Groffen <grobian@gentoo.org>2015-08-11 19:59:30 +0200
commitd005f1ff4643aeba2e3dfe1ab593e519b0612600 (patch)
tree2bf3a25800061123c3119c7ee49e9170cdbff0f2 /scripts/rsync-generation/push-rsync1.sh
parentadjust_path: chpathtool is in portage for ages (diff)
downloadprefix-d005f1ff4643aeba2e3dfe1ab593e519b0612600.tar.gz
prefix-d005f1ff4643aeba2e3dfe1ab593e519b0612600.tar.bz2
prefix-d005f1ff4643aeba2e3dfe1ab593e519b0612600.zip
rsync-generation: add the scripts used for generating the rsync tree
Diffstat (limited to 'scripts/rsync-generation/push-rsync1.sh')
-rwxr-xr-xscripts/rsync-generation/push-rsync1.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/rsync-generation/push-rsync1.sh b/scripts/rsync-generation/push-rsync1.sh
new file mode 100755
index 0000000000..fc15894ecd
--- /dev/null
+++ b/scripts/rsync-generation/push-rsync1.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+TRGDIR="rsync1.domain::rsync-push_module"
+LOCALDIR="/path/to/master-rsync-tree"
+
+# figure out what's currently the active rsync1 mirror
+#active=$(ssh $TRGHOST "readlink $TRGDIR/rsync1")
+#echo "($(date +"%F %R")) current active snapshot on rsync1: ${active}"
+
+#case $active in
+# rsync1a) target=rsync1b ;;
+# rsync1b) target=rsync1a ;;
+# *)
+# echo "don't know what the active rsync1 mirror is: '$active'" > /dev/stderr
+# exit 1
+# ;;
+#esac
+echo "($(date +"%F %R")) will refresh and activate snapshot: ${target}"
+
+# synchronise the target
+rsync -va --delete "${LOCALDIR}"/ ${TRGDIR}/ > /var/tmp/rsync-updates.log || exit 1
+
+# switch the active rsync1 mirror
+echo "($(date +"%F %R")) rsync done, switching target now"
+#ssh $TRGHOST "cd ${TRGDIR} && rm rsync1 && ln -s ${target} rsync1"