Q: --one-file-system and nested file systems

Brian McEntire brianm at fsg1.nws.noaa.gov
Thu Apr 8 18:35:20 GMT 2004

Thanks Wayne! 

> reading of the files on the source machine.  However, you can include
> all the source filesystems as args in a single copy command and it will
> enforce the single-filesystem (inode-based) restriction separately for
> each arg you specify:
>   rsync -avxR -e ssh --numeric-ids --delete \
>     --exclude-from=/backups/control/all.exclude \
>     root at B:'/ /usr /usr/local /usr/local/apache' /backups/B

That works great from the command line. One follow-up question for anyone 
with good shell scripting experience:

I'm trying to automate this with a Bash script to grab file systems from a
couple of remote hosts.  Here's how I get a list of the file systems local
to the remote hosts within the script:

FILESYSTEMS=`ssh $remHost df -l|awk '/\// {print $NF}'`

Variable FILESYSTEMS then contains, for example:

But when try to make the rsync call from my script:
  rsync ... root at B:\'$FILESYSTEMS\' /backups/B

I can't get the quoting right. I don't know if its me (probably :-) or the 
shell or rsync. I've tried variations with '' or " but no luck yet.

The script contains:

rsync -av -e 'ssh -q' --one-file-system --numeric-ids --relative \
    --delete --exclude-from=$CONTROL/all.exclude $CONDEXCLUDE \
    root@$SRCHOST:\'${FILESYSTEMS}\' . 
But here's what tries to get executed (set -x in the script shows each
command to be executed):

rsync -av -e 'ssh -q' --one-file-system --numeric-ids --relative --delete
--exclude-from=/backups/control/all.exclude 'root at B:'\''/' /boot /dev/shm
'/sandbox'\''' .

Does anyone know a good way to quote or set the FILESYSTEMS variable so I 
can effectively run, from within a script:
  rsync ... root at B:$FILESYSTEMS that will equate to root at B:'/ /boot /var' 

Thanks a bunch!! 

Not that it matters, I'm amazed by the patches and responses on this list!
Its awesome; reminds me of the old days of the Internet.  :-)

More information about the rsync mailing list