On Fri, Aug 3, 2012 at 4:10 AM, Martijn Rijkeboer <mart...@bunix.org> 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.
>>
>> Yep. $RSYNC_CMD will be splitted by space, tab or newline by default, or
>> by the contents of $IFS, if set.
>>
>> 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
>
> Using a function works without problems. Thanks to all who gave input.
>
> Kind regards,
>
>
> Martijn Rijkeboer

If you're doing complex rsync setups, you might also consider using
"rsnapshot" as a wrapper. I just joined the maintainer list on that,
it's a very useful old perl tool, well organized for frequent and well
managed backups.

Reply via email to