On 08/02/12 23:34, Matthew Dempsky wrote:
On Thu, Aug 2, 2012 at 2:21 PM, Martijn Rijkeboer <[email protected]> wrote:
RSYNC_CMD="/usr/local/bin/rsync -v -n \
     --rsync-path='rsync sudo' \

This doesn't do what you think it does.  The single quotes are getting
literally passed to rsync, they're not reinterpreted after $RSYNC_CMD
is interpolated.

This is similar to running something like:

   rsync --rsync-path=\'rsync sudo\' backup@fqdn...


Yep. $RSYNC_CMD will be splitted by space, tab or newline by default, or by the contents of $IFS, if set.

And no, that is _not_ a suggestion to fiddle with $IFS. :-)

if you need it to be reusable, I'd suggest making it a function or so:

...

synchronize() {
        /usr/local/bin/rsync -v -n \
            --rsync-path='/usr/bin/sudo /usr/local/bin/rsync' \
            --archive --one-file-system --compress --hard-links \
            --numeric-ids --human-readable --delete-after \
            --backup --backup-dir=deleted/$TODAY \
            --exclude=deleted \
            "$@"
}

synchronize backup@fqdn:$DATADIR/dir/ $DATADIR/dir

synchronize backup2@host2:/home/ $DIR2/home/

synchronize --ignore-existing backup2@host3:/dir3/ $DIR3/dir3/

...

/Alexander

Reply via email to