From: Dobrica Pavlinusic Date: Sun, 29 Jul 2018 12:33:00 +0000 (+0200) Subject: rsync_host env var to specify destination host X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=7304eaa4b429f7cb28c4c193633a8fa249e88d80;p=gnt-info rsync_host env var to specify destination host --- diff --git a/rbd-snap-backup.sh b/rbd-snap-backup.sh index 3a897bf..8032f9d 100755 --- a/rbd-snap-backup.sh +++ b/rbd-snap-backup.sh @@ -5,6 +5,7 @@ test -z "$1" -o -z "$2" && echo "Usage: $0 instance disk" && exit 1 instance=$1 disk=$2 test -z "$backup" && backup="backup" +test -z "$rsync_host" && rsync_host="lib15" rbd_image=`gnt-instance info --static $instance | grep logical_id: | cut -d\' -f4 | grep "\.rbd\.disk$disk\$"` @@ -25,16 +26,16 @@ test ! -z "$offset" && offset=",offset=$offset" mount $rbd_dev /dev/shm/$rbd_image.snap -o noatime$offset -# XXX do rsync back to lib15 +# XXX do rsync back to $rsync_host rsync_args="" -if rsync lib15::$backup/$instance/rsync.args /dev/shm/$instance-rsync.args 2>/dev/null ; then +if rsync $rsync_host::$backup/$instance/rsync.args /dev/shm/$instance-rsync.args 2>/dev/null ; then rsync_args="`cat /dev/shm/$instance-rsync.args`" fi rsync -ravHzXA --inplace --numeric-ids --delete $rsync_args \ - /dev/shm/$rbd_image.snap/ lib15::$backup/$instance/$disk/ \ -&& ssh -i /root/.ssh/id_dsa-zfs lib15 lib15/$backup/$instance/$disk + /dev/shm/$rbd_image.snap/ $rsync_host::$backup/$instance/$disk/ \ +&& ssh -i /root/.ssh/id_dsa-zfs $rsync_host $rsync_host/$backup/$instance/$disk # XXX backup OK