rsync exit 0 before transfer complete

Donna Livingstone donna.livingstone at
Sat Dec 17 19:06:26 GMT 2005

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 ]
           # File does not exist or is non-zero
           echo "file $file does not exit or is 0 size" >> $LOGFILE
       echo "About to rsync at `date`" >> rsync.out
       if rsync -e rsh -av --timeout=60 `cat list` $SYS:/file_in >> 
rsync.out 2>&1
         echo "completed rsync successfully at `date`" >> rsync.out
         date >> filesent
         cat list >> filesent
         /bin/rm `cat list`

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
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)

More information about the rsync mailing list