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 fi
else else
if [ -n "$port" ]; then 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 else
cmd="rsync -avzq $snapper_new_info $remote:$snapper_target_snapshot" cmd="rsync -avzq $snapper_new_info $remote:$snapper_target_snapshot"
fi fi
@@ -866,11 +866,12 @@ run_finalize () {
printf "Tagging snapper metadata on target for configuration '%s' ...\n" "$selected_config" | tee $PIPE printf "Tagging snapper metadata on target for configuration '%s' ...\n" "$selected_config" | tee $PIPE
fi fi
i=1 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}'" 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? # !!! 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 ... # it is not deterministic, when the entry in the listing will show up .... for now, wait max 10 min ...
while [ "$i" -le 20 ]; do while [ "$i" -le "$max" ]; do
if [ -n "$ssh" ]; then if [ -n "$remote" ]; then
ret=$($ssh $cmd) ret=$($ssh $cmd)
else else
ret=$(eval $cmd) ret=$(eval $cmd)
@@ -889,7 +890,7 @@ run_finalize () {
fi fi
fi fi
if [ "$verbose" ]; then 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 fi
sleep 30 sleep 30
i=$(($i + 1)) i=$(($i + 1))