|
11 | 11 | # shellcheck source=share/github-backup-utils/ghe-backup-config
|
12 | 12 | . "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config"
|
13 | 13 |
|
| 14 | +# Check to make sure moreutils parallel is installed and working properly |
| 15 | +ghe_parallel_check |
| 16 | + |
14 | 17 | # Show usage and bail with no arguments
|
15 | 18 | [ -z "$*" ] && print_usage
|
16 | 19 |
|
@@ -128,17 +131,32 @@ for file_list in $tempdir/*.rsync; do
|
128 | 131 | else
|
129 | 132 | server=$host
|
130 | 133 | fi
|
| 134 | + |
131 | 135 | storage_user=$(ghe-ssh $ssh_config_file_opt $server:$port -- stat -c %U /data/user/storage || echo git)
|
132 | 136 |
|
133 |
| - ghe_verbose "* Transferring data to $server ..." |
| 137 | + rsync_commands+=(" |
| 138 | + if [ -n \"$GHE_VERBOSE\" ]; then |
| 139 | + echo \"* Transferring data to $server ...\" 1>&3 |
| 140 | + fi |
| 141 | +
|
134 | 142 | ghe-rsync -arvHR --delete \
|
135 |
| - -e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \ |
136 |
| - --rsync-path="sudo -u $storage_user rsync" \ |
| 143 | + -e \"ssh -q $opts -p $port $ssh_config_file_opt -l $user\" \ |
| 144 | + --rsync-path=\"sudo -u $storage_user rsync\" \ |
137 | 145 | --files-from=$file_list \
|
138 | 146 | --size-only \
|
139 |
| - "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/storage/./" \ |
140 |
| - "$server:$GHE_REMOTE_DATA_USER_DIR/storage/" 1>&3 |
| 147 | + \"$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/storage/./\" \ |
| 148 | + \"$server:$GHE_REMOTE_DATA_USER_DIR/storage/\" 1>&3 |
| 149 | + ") |
141 | 150 | done
|
| 151 | + |
| 152 | +if [ "$GHE_PARALLEL_ENABLED" = "yes" ]; then |
| 153 | + $GHE_PARALLEL_COMMAND $GHE_PARALLEL_RSYNC_COMMAND_OPTIONS -- "${rsync_commands[@]}" |
| 154 | +else |
| 155 | + for c in "${rsync_commands[@]}"; do |
| 156 | + eval "$c" |
| 157 | + done |
| 158 | +fi |
| 159 | + |
142 | 160 | bm_end "$(basename $0) - Restoring objects"
|
143 | 161 |
|
144 | 162 | if $CLUSTER; then
|
|
0 commit comments