X-Git-Url: https://git.distorted.org.uk/~mdw/rsync-backup/blobdiff_plain/3aa4fd301e1d65302ffe245e3318bb31601fc590..5b4c55ab790babed1a442f7204356c24663fe15c:/rsync-backup.in diff --git a/rsync-backup.in b/rsync-backup.in index 3802efb..67d0efb 100644 --- a/rsync-backup.in +++ b/rsync-backup.in @@ -133,7 +133,7 @@ hostrun () { ## way it will be processed by a shell. if localp $host; then run "@$host: $tag" sh -c "$cmd" - else run "@$host: $tag" ssh $host "$cmd" + else run "@$host: $tag" ssh $userat$host "$cmd" fi } @@ -153,7 +153,7 @@ hostpath () { ## current host is local. if localp $host; then echo $path - else echo $host:$path + else echo $userat$host:$path fi } @@ -310,7 +310,7 @@ do_rfreezefs () { ## Get the volume host to create the snapshot. set +e - _hostrun >&2 3>&- $lvhost \ + _hostrun >&2 3>&- $userat$lvhost \ "lvcreate --snapshot -n$lv.bkp $SNAPSIZE $vg/$lv" snaprc=$? set -e @@ -321,7 +321,7 @@ do_rfreezefs () { case $tok in "$tok_THAWED") ;; *) - _hostrun >&2 3>&- $lvhost "lvremove -f $vg/$lv.bkp" || : + _hostrun >&2 3>&- $userat$lvhost "lvremove -f $vg/$lv.bkp" || : echo >&2 "$quis: unexpected token $tok (rfreezefs $fsdir on $fshost)" exit 1 ;; @@ -348,7 +348,7 @@ do_rfreezefs () { esac ## Mount the snapshot on the volume host. - _hostrun >&2 $lvhost " + _hostrun >&2 $userat$lvhost " mkdir -p $SNAPDIR/$lv mount -oro /dev/$vg/$lv.bkp $SNAPDIR/$lv" } @@ -525,7 +525,7 @@ unset VOLUME bkprc=0 remote_fshash () { - _hostrun $host " + _hostrun $userat$host " umask 077 mkdir -p $fshashdir cd ${snapmnt#*:} @@ -841,7 +841,7 @@ backup () { host () { host=$1 - like= + like= userat= case "${expire_policy+t},${default_policy+t}" in t,) default_policy=$expire_policy ;; esac @@ -853,6 +853,7 @@ snaptype () { snap=$1; shift; snapargs="$*"; retry=0; } rsyncargs () { rsyncargs="$*"; } like () { like="$*"; } retry () { retry="$*"; } +user () { userat="$*@"; } retain () { case $clear_policy in t) unset expire_policy; clear_policy=nil ;; esac @@ -864,7 +865,7 @@ retain () { ### Read the configuration and we're done. usage () { - echo "usage: $quis [-v] [-c CONF]" + echo "usage: $quis [-nv] [-c CONF]" } version () {