RE: How to rsync PULL multiple files/dirs

2006-01-27 Thread Jonathan Chen -X (jonachen - The Armada Group, Inc. at Cisco)
Thanks!  Now I have a different problem but related to rsync pull.
Currently I can't figure out what is wrong with my bash script or don't
see the error.  Hopefully the information below is enough.

When I echo the command it looks like below...

/usr/bin/rsync -e ssh --archive --sparse --compress --update --dry-run
--exclude=cdersync.tar.gz --exclude=*.bz2  --exclude=*.jpg
--exclude=*.mp3 --exclude=ZDE --exclude=*.rpm --exclude=*.sit
[EMAIL PROTECTED]:' /users/jona/cde /users/jona/Desktop  /users/jona/.bashrc
/users/jona/.profile' /users/jona/ 

Just pasting via terminal it works great.

But executing with bash -x the below lines...

#grouping together
RSYNC_CMD=${RSYNC_CMD} ${RSYNC_ARGS} $RSYNC_DEST_HOST${RSYNC_FILES}

#excuting
${RSYNC_CMD}

#bash debug result
+ /usr/bin/rsync -e ssh --archive --sparse --compress --update --dry-run
--exclude=cdersync.tar.gz '--exclude=*.bz2' '--exclude=*.jpg'
'--exclude=*.mp3' --exclude=ZDE '--exclude=*.rpm' '--exclude=*.sit'
'[EMAIL PROTECTED]:'\''' /users/jona/cde /users/jona/Desktop
/users/jona/.bashrc '/users/jona/.profile'\''' /users/jona/

Would return rsync error: syntax or usage error (code 1) at
main.c(836)

Any idea what I did wrong?

 -Original Message-
 From: Wayne Davison [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 26, 2006 5:11 PM
 To: Jonathan Chen -X (jonachen - The Armada Group, Inc. at Cisco)
 Cc: rsync@lists.samba.org
 Subject: Re: How to rsync PULL multiple files/dirs
 
 On Thu, Jan 26, 2006 at 04:59:04PM -0800, Jonathan Chen -X 
 (jonachen - The Armada Group,  Inc. at Cisco) wrote:
  I would like the below statement be turned into a PULL from remote 
  host [...]  /users/jona/cde /users/jona/Desktop /users/jona/.bashrc 
  /users/jona/.profile cdeprd:/users/jona/
 
 The ADVANCED USAGE section of the rsync manpage explains 
 how to specify multiple source items from a remote rsync.  
 For instance:
 
 rsync [OPTIONS] [EMAIL PROTECTED]:'cde Desktop .bashrc .profile' /users/jona
 
 ..wayne..
 
--
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


RE: How to rsync PULL multiple files/dirs

2006-01-27 Thread Matt McCutchen
On Fri, 2006-01-27 at 18:10 -0800, Jonathan Chen -X (jonachen - The
Armada Group, Inc. at Cisco) wrote:
 /usr/bin/rsync -e ssh --archive --sparse --compress --update --dry-run
 --exclude=cdersync.tar.gz --exclude=*.bz2  --exclude=*.jpg
 --exclude=*.mp3 --exclude=ZDE --exclude=*.rpm --exclude=*.sit
 [EMAIL PROTECTED]:' /users/jona/cde /users/jona/Desktop  /users/jona/.bashrc
 /users/jona/.profile' /users/jona/ 
 
 RSYNC_CMD=${RSYNC_CMD} ${RSYNC_ARGS} $RSYNC_DEST_HOST${RSYNC_FILES}
 ${RSYNC_CMD}

The variable version doesn't match the written-out version.  I think the
variable version was supposed to be something like this:
RSYNC_CMD=${RSYNC_CMD} ${RSYNC_ARGS} $RSYNC_SRC_HOST${RSYNC_FILES} 
/users/jona

The problem clearly has to do with quoting and word splitting.  rsync
expects a single argument with the source host and all the filenames so
that the remote shell can split them:
/usr/bin/rsync
[...]
--exclude=*.sit
[EMAIL PROTECTED]:/users/jona/cde /users/jona/Desktop 
/users/jona/.bashrc /users/jona/.profile
/users/jona

But bash parsed the command into these arguments (look closely at the
debug output):
/usr/bin/rsync
[...]
--exclude=*.sit
[EMAIL PROTECTED]:'
/users/jona/cde
/users/jona/Desktop
/users/jona/.bashrc
/users/jona/.profile'
/users/jona

The single quotes are coming out literally, probably because they are
inside other quotes.  If you have something like this:
RSYNC_FILES=' /users/jona/cde /users/jona/Desktop'
delete the single quotes.  You can also get rid of that extraneous space
in front of /users/jona/cde.

Secondly, when you store everything into $RSYNC_CMD, the entire source
argument is substituted in such a way that its internal spaces (which
should be kept and processed by the remote shell) can no longer be
distinguished from the spaces separating it from other arguments.  When
you run $RSYNC_CMD, bash splits on all the spaces.  To avoid this, don't
use $RSYNC_CMD.  Run the command as soon as you put it together from its
pieces, quoting RSYNC_FILES to protect the internal spaces.  Do
something like this:
${RSYNC_CMD} ${RSYNC_ARGS} $RSYNC_SRC_HOST${RSYNC_FILES} /users/jona

I'm missing the lines of your script that set RSYNC_ARGS and so forth,
so these steps may not be exactly right.  If you can't get the script to
work, send the whole script.
-- 
Matt McCutchen, ``hashproduct''
[EMAIL PROTECTED] -- http://mysite.verizon.net/hashproduct/

-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


CVS update: rsync

2006-01-27 Thread Wayne Davison

Date:   Fri Jan 27 12:59:07 2006
Author: wayned

Update of /data/cvs/rsync
In directory dp.samba.org:/tmp/cvs-serv24874

Modified Files:
flist.c 
Log Message:
Optimized flist_find() so that we never scan a series of empty
file-list items twice (which can be very important with the new
--skip-empty-dirs option).  Also optimized the code that strips
root slashes in clean_flist().


Revisions:
flist.c 1.328 = 1.329
http://www.samba.org/cgi-bin/cvsweb/rsync/flist.c?r1=1.328r2=1.329
___
rsync-cvs mailing list
rsync-cvs@lists.samba.org
https://lists.samba.org/mailman/listinfo/rsync-cvs


CVS update: rsync

2006-01-27 Thread Wayne Davison

Date:   Fri Jan 27 14:29:58 2006
Author: wayned

Update of /data/cvs/rsync
In directory dp.samba.org:/tmp/cvs-serv5821

Modified Files:
flist.c 
Log Message:
Improved flist_find()'s empty-entry handling to deal with the case
where more entries may have been removed since the last find.


Revisions:
flist.c 1.329 = 1.330
http://www.samba.org/cgi-bin/cvsweb/rsync/flist.c?r1=1.329r2=1.330
___
rsync-cvs mailing list
rsync-cvs@lists.samba.org
https://lists.samba.org/mailman/listinfo/rsync-cvs