File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4848# directory, using a previous snapshot to avoid transferring files that have
4949# already been transferred.
5050echo " * Performing initial sync of ES indices ..." 1>&3
51- rsync -avz \
51+ ghe- rsync -avz \
5252 -e " ghe-ssh -p $( ssh_port_part " $host " ) " \
5353 --rsync-path=' sudo -u git rsync' \
5454 $link_dest \
@@ -73,7 +73,7 @@ ghe-ssh "$host" -- curl -s -XPOST "localhost:9200/_flush" >/dev/null
7373
7474# Transfer all ES indices again
7575echo " * Performing follow-up sync of ES indices ..." 1>&3
76- rsync -avz \
76+ ghe- rsync -avz \
7777 -e " ghe-ssh -p $( ssh_port_part " $host " ) " \
7878 --rsync-path=' sudo -u git rsync' \
7979 $link_dest \
Original file line number Diff line number Diff line change 3232# Transfer Pages data from a GitHub instance to the current snapshot
3333# directory, using a previous snapshot to avoid transferring files that have
3434# already been transferred.
35- rsync -avz \
35+ ghe- rsync -avz \
3636 -e " ghe-ssh -p $( ssh_port_part " $host " ) " \
3737 --rsync-path=' sudo -u git rsync' \
3838 $link_dest \
Original file line number Diff line number Diff line change 9292# already been transferred. A set of rsync filter rules are provided on stdin
9393# for each invocation.
9494rsync_repository_data () {
95- rsync -av \
95+ ghe- rsync -av \
9696 -e " ghe-ssh -p $( ssh_port_part " $host " ) " \
9797 $link_dest " $@ " \
9898 --rsync-path=' sudo -u git rsync' \
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ host="$1"
2323# Transfer all Pages data from the latest snapshot to the GitHub instance
2424# in a single rsync invocation.
2525if [ -d " $GHE_DATA_DIR /$GHE_RESTORE_SNAPSHOT /pages/" ]; then
26- rsync -avz --delete \
26+ ghe- rsync -avz --delete \
2727 -e " ghe-ssh -p $( ssh_port_part " $host " ) " \
2828 --rsync-path=" sudo -u git rsync" \
2929 " $GHE_DATA_DIR /$GHE_RESTORE_SNAPSHOT /pages/" \
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ host="$1"
2222
2323# Transfer all git repository data from the latest snapshot to the GitHub
2424# instance in a single rsync invocation.
25- rsync -av --delete \
25+ ghe- rsync -av --delete \
2626 -e " ghe-ssh -p $( ssh_port_part " $host " ) " \
2727 --rsync-path=" sudo -u git rsync" \
2828 " $GHE_DATA_DIR /$GHE_RESTORE_SNAPSHOT /repositories/" \
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # / Usage: ghe-rsync
3+ # / Run rsync with silenced vanished file warnings (non-critical).
4+ #
5+ # Based on the rsync-no-vanished support script included with rsync:
6+ # https://bugzilla.samba.org/show_bug.cgi?id=10356
7+
8+ set -o pipefail
9+
10+ # Filter vanished file warnings from both stdout (rsync versions < 3.x) and
11+ # stderr (rsync versions >= 3.x). The complex redirections are necessary to
12+ # filter stderr while also keeping stdout and stderr separated.
13+ IGNOREOUT=' ^(file has vanished: |rsync warning: some files vanished before they could be transferred)'
14+ (rsync " ${@ } " 3>&1 1>&2 2>&3 3>& - |
15+ (egrep -v " $IGNOREOUT " || true)) 3>&1 1>&2 2>&3 3>& - |
16+ (egrep -v " $IGNOREOUT " || true)
17+ res=$?
18+
19+ # rsync exits with 24 when vanished files are detected.
20+ if [ $res = 24 ]; then
21+ res=0
22+ fi
23+
24+ exit $res
You can’t perform that action at this time.
0 commit comments