From 6479b821ebc04d9e2ec69be451768968c06ce6a5 Mon Sep 17 00:00:00 2001
From: Jacob Vosmaer <contact@jacobvosmaer.nl>
Date: Mon, 5 Oct 2015 18:02:12 +0200
Subject: [PATCH] Add RSYNC variable to parallel-rsync-repos

---
 bin/parallel-rsync-repos | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 bin/parallel-rsync-repos

diff --git a/bin/parallel-rsync-repos b/bin/parallel-rsync-repos
old mode 100644
new mode 100755
index b2429f743b5..b777056c95f
--- a/bin/parallel-rsync-repos
+++ b/bin/parallel-rsync-repos
@@ -4,6 +4,15 @@
 # Example invocation:
 # find /var/opt/gitlab/git-data/repositories -maxdepth 2 | \
 #   parallel-rsync-repos /var/opt/gitlab/git-data/repositories /mnt/gitlab/repositories
+#
+# You can also rsync to a remote destination.
+#
+# parallel-rsync-repos /var/opt/gitlab/git-data/repositories user@host:/mnt/gitlab/repositories
+#
+# If you need to pass extra options to rsync, set the RSYNC variable
+#
+# env RSYNC='rsync --rsh="foo bar"' parallel-rsync-repos /src dest
+#
 
 SRC=$1
 DEST=$2
@@ -17,10 +26,14 @@ if [ -z "$SRC" ] || [ -z "$DEST" ] ; then
   exit 1
 fi
 
+if [ -z "$RSYNC" ] ; then
+  RSYNC=rsync
+fi
+
 if ! cd $SRC ; then
   echo "cd $SRC failed"
   exit 1
 fi
 
 sed "s|$SRC|./|" |\
-  parallel -j$JOBS --progress "mkdir -p $DEST/{} && rsync --delete -a {}/. $DEST/{}/"
+  parallel -j$JOBS --progress "mkdir -p $DEST/{} && $RSYNC --delete -a {}/. $DEST/{}/"
-- 
GitLab