Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1641  / 2 Years ago, wed, may 18, 2022, 11:05:39

The following is a snip of output from bash -vx on my backup script



+ rsync '' -avushi --stats --progress
--log-file=/home/bigbird/temp/rlog/rlog1.txt
/media/dataspace/data/webcasts/ /media/work/data/webcasts



sending incremental file list



I've been doing rsyncs like this forever and I just saw this problem in
the last month or two. This one is running on Kubuntu Oneiric, but I
think I may have seen it on Kubuntu Lucid as well.



The script is being run from /home/bigbird/bin



It works perfectly except that it additionally transfers all the files
from my current directory to the destination. I also have a second rsync
later in the script that does the same thing to another directory.



I just ran it again from another directory and it copied all of those
files instead.



I don't see a "." in the source anywhere etc.



I did a set | less



Looked at all my ~/bin files



Looked at all my aliases



I don't have a clue as to what would be causing this.



Where do I look for the problem?


More From » rsync

 Answers
3

Original code was



DRYRUN="-n"
DRYRUN=""
...

rsync "${DRYRUN}" -avushi --stats --progress --log-file="${LOGFILE}"
/media/dataspace/data/webcasts/ "${MOUNT}${DESTDIR}"


Working code is



DRYRUN=1      ## for testing rsync without any file transfers
DRYRUN=0 ## for live run
...
if (( ${DRYRUN} ))
then
rsync -n -avushi --stats --progress --log-file="${LOGFILE2}" /media/dataspace"${DESTDIR2}"/ "${MOUNT}${DESTDIR2}"
else
rsync -avushi --stats --progress --log-file="${LOGFILE2}" /media/dataspace"${DESTDIR2}"/ "${MOUNT}${DESTDIR2}"
fi


"We have met the enemy, and he is us!" - Walt Kelly (Pogo comic strip)



I found it! Invisible doesn't mean it's not there.



I don't quite understand what happened, but, by putting "${DRYRUN}" in the rsync command line it made the first argument to rsync "". Apparently that got
interpreted as PWD instead of as an error. So the command was transfer ""
and my real source to my real destination because rsync accepts multiple
sources.



The remaining question is why does rsync think that "" means current directory instead of interpreting it as a syntax error?


[#39871] Friday, May 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
farnic

Total Points: 409
Total Questions: 117
Total Answers: 125

Location: Andorra
Member since Sat, May 27, 2023
1 Year ago
;