snap-sync: enable remote syncing to selectable port

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2018-01-19 16:30:44 +01:00
parent 108a9efc1d
commit b91b1e0cc0

View File

@@ -791,7 +791,7 @@ run_backup () {
fi
else
if [ -n "$port" ]; then
cmd="rsync -avzq -e \"ssh -p $port\" $snapper_new_info $remote:$snapper_target_snapshot
cmd="rsync -avzq -e \"ssh -p $port\" $snapper_new_info $remote:$snapper_target_snapshot"
else
cmd="rsync -avzq $snapper_new_info $remote:$snapper_target_snapshot"
fi
@@ -866,11 +866,12 @@ run_finalize () {
printf "Tagging snapper metadata on target for configuration '%s' ...\n" "$selected_config" | tee $PIPE
fi
i=1
max=20
cmd="snapper --verbose --config \"$snapper_target_config\" list --type single | awk '/'\"$snap_description_running\"'/' | awk -F '|' '\$1 == "$snapper_new_id" {print \$1}'"
# !!! ugly hack !!!: wait for snapper to list target snapshot in database. how to trigger database resync?
# it is not deterministic, when the entry in the listing will show up .... for now, wait max 10 min ...
while [ "$i" -le 20 ]; do
if [ -n "$ssh" ]; then
while [ "$i" -le "$max" ]; do
if [ -n "$remote" ]; then
ret=$($ssh $cmd)
else
ret=$(eval $cmd)
@@ -889,7 +890,7 @@ run_finalize () {
fi
fi
if [ "$verbose" ]; then
printf "Waiting for snappers database update on target ...\n"
printf "Waiting for snappers database update on target %s/%s ...\n" "$i" "$max"
fi
sleep 30
i=$(($i + 1))