Skip to content
Snippets Groups Projects
Commit 6479b821 authored by Jacob Vosmaer's avatar Jacob Vosmaer
Browse files

Add RSYNC variable to parallel-rsync-repos

parent 4dd7c2f1
No related branches found
No related tags found
No related merge requests found
Loading
@@ -4,6 +4,15 @@
Loading
@@ -4,6 +4,15 @@
# Example invocation: # Example invocation:
# find /var/opt/gitlab/git-data/repositories -maxdepth 2 | \ # find /var/opt/gitlab/git-data/repositories -maxdepth 2 | \
# parallel-rsync-repos /var/opt/gitlab/git-data/repositories /mnt/gitlab/repositories # 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 SRC=$1
DEST=$2 DEST=$2
Loading
@@ -17,10 +26,14 @@ if [ -z "$SRC" ] || [ -z "$DEST" ] ; then
Loading
@@ -17,10 +26,14 @@ if [ -z "$SRC" ] || [ -z "$DEST" ] ; then
exit 1 exit 1
fi fi
   
if [ -z "$RSYNC" ] ; then
RSYNC=rsync
fi
if ! cd $SRC ; then if ! cd $SRC ; then
echo "cd $SRC failed" echo "cd $SRC failed"
exit 1 exit 1
fi fi
   
sed "s|$SRC|./|" |\ 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/{}/"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment