summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-09-25 18:31:54 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-09-25 18:32:02 +0200
commit5bcd0efe3e0b1fef06147d87f843adac717d7c42 (patch)
tree17397dba894df43d599cfb6a5d073446d3fd4090 /bin
parent7a8a892efdf59925a95cdf6504f7c74c31b87eeb (diff)
downloadgitlab-ce-5bcd0efe3e0b1fef06147d87f843adac717d7c42.tar.gz
Add parallel-rsync-repos script and start docs
Diffstat (limited to 'bin')
-rw-r--r--bin/parallel-rsync-repos26
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/parallel-rsync-repos b/bin/parallel-rsync-repos
new file mode 100644
index 00000000000..b2429f743b5
--- /dev/null
+++ b/bin/parallel-rsync-repos
@@ -0,0 +1,26 @@
+#!/bin/sh
+# this script should run as the 'git' user, not root, because of mkdir
+#
+# Example invocation:
+# find /var/opt/gitlab/git-data/repositories -maxdepth 2 | \
+# parallel-rsync-repos /var/opt/gitlab/git-data/repositories /mnt/gitlab/repositories
+
+SRC=$1
+DEST=$2
+
+if [ -z "$JOBS" ] ; then
+ JOBS=10
+fi
+
+if [ -z "$SRC" ] || [ -z "$DEST" ] ; then
+ echo "Usage: $0 SRC DEST"
+ exit 1
+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/{}/"