Browse Source

fix: [0km] remove last direct ssh access to backup server

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
rc1
Valentin Lab 4 years ago
parent
commit
9668d9d326
  1. 10
      bin/0km

10
bin/0km

@ -235,6 +235,11 @@ vps_check() {
vps:rsync() {
rsync_options=()
while [[ "$1" == "-"* ]]; do
rsync_options+=("$1")
shift
done
local vps="$1" id="$2" src="$3" dst="$4"
if [[ "$src" != *":"* ]]; then
err "Third argument '$src' should be a remote (include the server name as prefix)."
@ -246,7 +251,7 @@ vps:rsync() {
rsync -e "ssh ${ssh_options[*]}" \
-azvArH --delete --delete-excluded \
--partial --partial-dir .rsync-partial \
--numeric-ids \
--numeric-ids ${rsync_options[*]} \
"$server":/var/mirror/"${id}${src}" "${dst}"
EOF
@ -322,7 +327,8 @@ EOF
for vol in postfix rspamd redis crypt vmail{,-attachments}; do
volume_name="mailcowdockerized_${vol}-vol-1"
volume_dir="/var/lib/docker/volumes/${volume_name}/_data"
if ! ssh:run "root@$server" -- "[ -d '$BACKUP_PATH/${id}${volume_dir}' ]"; then
if ! vps:rsync -nd --no-r "$vps" "$id" "$server":"${volume_dir}/" "/tmp/dummy" >/dev/null 2>&1; then
warn "No '$volume_name' in backup. This might be expected."
continue
fi

Loading…
Cancel
Save