Here is what I have been doing with rsync(This is condinced version of
the main script that runs):
#!/usr/local/bin/bash
SSH=/usr/local/bin/ssh
RSYNC=/usr/local/bin/rsync
SED=/usr/bin/sed
USER=vmladmin
ROLLLISTDIR=/home/vmladmin/rolllists/
ROLLFILE=${ROLLLISTDIR}rollfile.${CELERITYID}
EXCLUDEFILE=${ROLLLISTDIR}rollfile.exclude
RSYNC_OPT="-zrc --delete"
EXCLUDE="--exclude-from=${EXCLUDEFILE}"
BACKUP="--backup-dir=/opt/staging/rollbackup/${CELERITYID}-`date
+%Y%m%d%H%M`"
rsyncfiles ()
{
SERVER=${1}
SRCDIR=${2}
DESTDIR=${3}
for FILES in `cat ${ROLLFILE} | sed 's~ $~~g' | tr " "
"@"`
do
FNAME=`echo ${FILES} | ${SED} 's~@~\ ~g'`
${RSYNC} -e "${SSH}" -nv ${RSYNC_OPT} ${EXCLUDE}
${BAKCUP} "${SRCDIR}${FNAME}"
${USER}@${SERVER}:"${DESTDIR}${FNAME}"
done
}
What my script does, takes a list of filename found in ${ROLLFILE} and
runs a for loop that uses rsync to move the list of files from one
server to another. This work correctly even syncing files that exist in
a dir that is symlinked to another dir on the file system. After
upgrading to 2.6.0 when I moved to newer servers I decided to change my
script some. One of the things I am to make work is the --files-from
option that is now avalible. Here is somewhat of what my new script
does:
#!/usr/local/bin/bash
###OPTIONS####
rsyncfiles ()
{
RSYNC_OPT=${1}
FROMFILE=${2}
SOURCE=${3} # user@host: or :
DESTINATION=${4} # user@host: or :
if [ -r "${FROMFILE}" ]
then
echo ${RSYNCCMD} -e "${SSH}" ${RSYNC_OPT} ${EXCLUDE} ${INCLUDE}
--files-from=${FROMFILE} ${SOURCE} ${DESTINATION}
${RSYNCCMD} -e "${SSH}" ${RSYNC_OPT} ${EXCLUDE}
${INCLUDE} --files-from=${FROMFILE} ${SOURCE} ${DESTINATION}
fi
}
Which I pass a command like:
rsyncfiles "${RSYNC_OPT}" "${WEBROLLFILE}" "/"
"${USER}@prodweb1:/"
This now give me an error like this when I sync the same filelist that
works with the first setup:
delete_file: unlink "//opt/bea/vml" failed: Permission denied
symlink "//opt/bea/vml" ->
"/opt/bea/user_projects/domains/cp-sb1/applications" failed: File
exists
rsync error: some files could not be transferred (code 23) at
main.c(632)
The new script works great as long as there is a not a symlinked dir in
the path. So far I have nto been able to find anything on the list or
in the main page to help me with this. Does anyone have any ideas how I
get this to work with the --files-from option?
Jeremy Grant
Unix System Admin
VML
On Tue, Mar 23, 2004 at 06:33:48PM -0600, Jeremy Grant wrote:> Does anyone have any ideas how I get this to work with the > --files-from option?Try using the --no-implied-dirs option. With that set, you'll need to mention all the directories that need to be created on the destination system, but rsync won't try to twiddle any dirs in the path of a sent file. ..wayne..