On a Redhat ES 3 system running rsync-2.5.7-5.3E I have a script which sends files to other servers. I have noted lately that occasionally rsync will exit with a code of 0 prematurely. See below a snippet of the code I am using : if [ ! -s $file ] then # File does not exist or is non-zero echo "file $file does not exit or is 0 size" >> $LOGFILE fi echo "About to rsync at `date`" >> rsync.out if rsync -e rsh -av --timeout=60 `cat list` $SYS:/file_in >> rsync.out 2>&1 then echo "completed rsync successfully at `date`" >> rsync.out date >> filesent cat list >> filesent /bin/rm `cat list` fi See below for a example of the failure in the rsync.out file : - note the two echo outputs. The exit status from rsync was successful(ie 0). - the rsync output appears after the "completed ..." line in the file. - rsync reports the file as missing however this is probably due to the rm ocurring BEFORE the transfer is complete. - the before the transfer guarentees the file is there. Any ideas ? About to rsync at Sat Dec 17 04:55:54 MST 2005 completed rsync successfully at Sat Dec 17 04:55:54 MST 2005 building file list ... link_stat FILE.234 : No such file or directory done wrote 25 bytes read 20 bytes 30.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files could not be transferred (code 23) at main.c(620) -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
On Sat, Dec 17, 2005 at 12:06:26PM -0700, Donna Livingstone wrote:> wrote 25 bytes read 20 bytes 30.00 bytes/sec > total size is 0 speedup is 0.00 > rsync error: some files could not be transferred (code 23) at main.c(620)This trailing error is output from the _cleanup_exit() routine right before rsync exits with the "code" value (23 in this case), so I fail to see how rsync could be exiting with a 0 value. Version 2.5.7 is 2 years old now, but I did try running it, and in an identical failure-scenario (even using rsh instead of my normal ssh) it exited with the right exit code. I''d suggest checking to ensure that you don''t have an rsync script, alias, or function that is losing the return code. (Perhaps you should change the "rsync" in your script to "/usr/bin/rsync".) ..wayne..
Thanks for the reply. The code works 99% of the time - the outlined scenario has only occurred abot 20 times out of 1500 transfers this month. It has also worked for three months previously wothout a problem. The only change has been the load on the system in the past month. Given what you say the only other possibility I see is that the "if" code is failing - not a nice thought. I have mitigated the problem by placing a delay(sleep) just after the if and have been running error free for two days. Wayne Davison wrote:>On Sat, Dec 17, 2005 at 12:06:26PM -0700, Donna Livingstone wrote: > > >>wrote 25 bytes read 20 bytes 30.00 bytes/sec >>total size is 0 speedup is 0.00 >>rsync error: some files could not be transferred (code 23) at main.c(620) >> >> > >This trailing error is output from the _cleanup_exit() routine right >before rsync exits with the "code" value (23 in this case), so I fail to >see how rsync could be exiting with a 0 value. Version 2.5.7 is 2 years >old now, but I did try running it, and in an identical failure-scenario >(even using rsh instead of my normal ssh) it exited with the right exit >code. > >I''d suggest checking to ensure that you don''t have an rsync script, >alias, or function that is losing the return code. (Perhaps you should >change the "rsync" in your script to "/usr/bin/rsync".) > >..wayne.. > > >-------------- next part -------------- HTML attachment scrubbed and removed
On Sat, 17 Dec 2005, Donna Livingstone <donna.livingstone@shaw.ca> wrote:> > See below a snippet of the code I am using : > > if [ ! -s $file ] > then > # File does not exist or is non-zero > echo "file $file does not exit or is 0 size" >> $LOGFILE > fi > echo "About to rsync at `date`" >> rsync.out > if rsync -e rsh -av --timeout=60 `cat list` $SYS:/file_in >> rsync.out 2>&1 > then > echo "completed rsync successfully at `date`" >> rsync.out > date >> filesent > cat list >> filesent > /bin/rm `cat list` > fiThe rsync output occuring after the ''completed'' output means that rsync is running detached in the background and the shell continued on after starting it (prematurely removing the file that was being transferred before rsync got to it). To debug this - add a few lines: echo "About to rsync at `date`" >> rsync.out which rsync >> rsync.out #DEBUG - find out which rsync is being run if rsync -e rsh -av --timeout=60 `cat list` $SYS:/file_in >> rsync.out 2>&1 then ps auxwwf >> rsync.out #DEBUG - show process tree to find rsync echo "completed rsync successfully at `date`" >> rsync.out and then run your script to transfer a large file that will take, say, at least 10 seconds in order to give the ps a chance to do its thang. The ''f'' option shows the process ''forest''s (trees) so you can see if the rsync process got detached from the script shell. If it did... well - you''ll have to figure out why, ''cause I don''t know. :) John