2020-11-15 18:27:57 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -x -e
|
|
|
|
|
|
|
|
cd /root
|
|
|
|
|
|
|
|
chmod 0600 .ssh/id_ed25519
|
|
|
|
|
|
|
|
cat > .ssh/config <<EOF
|
|
|
|
Host backuphost
|
|
|
|
HostName $TARGET_SSH_HOST
|
|
|
|
Port $TARGET_SSH_PORT
|
|
|
|
User $TARGET_SSH_USER
|
|
|
|
EOF
|
|
|
|
|
2020-11-15 18:43:33 +00:00
|
|
|
consul kv export | \
|
|
|
|
gzip | \
|
|
|
|
age -r "$(cat /root/.ssh/id_ed25519.pub)" | \
|
2020-11-15 19:14:19 +00:00
|
|
|
ssh backuphost "cat > $TARGET_SSH_DIR/consul/$(date --iso-8601=minute)_consul_kv_export.gz.age"
|
2020-11-15 18:27:57 +00:00
|
|
|
|