Use scp for cross-host ops backups
This commit is contained in:
1 parent
1c66dc1b12
commit
e26c640f8a
1 file changed
+5
-3
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -uo pipefail
|
||||
export COPYFILE_DISABLE=1
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
if [ -n "$(git -C "$repo_root" status --porcelain -- ops)" ]; then
|
||||
@@ -26,8 +25,11 @@ printf 'ok\tlocal\t%s\n' "$local_target"
|
||||
|
||||
sync_remote() {
|
||||
local host="$1" relative_target="$2"
|
||||
if tar -C "$stage" -czf - . | ssh -o BatchMode=yes -o ConnectTimeout=8 "$host" \
|
||||
"mkdir -p '$relative_target' && find '$relative_target' -type f -name '._*' -delete && COPYFILE_DISABLE=1 tar -xzf - -C '$relative_target'"; then
|
||||
if ssh -o BatchMode=yes -o ConnectTimeout=8 "$host" \
|
||||
"mkdir -p '$relative_target' && find '$relative_target' -type f -name '._*' -delete" \
|
||||
&& scp -q -r "$stage/ops" "$stage/BACKUP-MANIFEST.txt" "$host:$relative_target/" \
|
||||
&& ssh -o BatchMode=yes -o ConnectTimeout=8 "$host" \
|
||||
"test -s '$relative_target/BACKUP-MANIFEST.txt' && test -f '$relative_target/ops/README.md'"; then
|
||||
printf 'ok\t%s\t%s\n' "$host" "$relative_target"
|
||||
return 0
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user