@@ -154,20 +154,21 @@ while [[ $rc -ne 0 && $RETRY -lt $MAX_RETRIES ]]; do
154154 if [[ -s /tmp/filelist.txt ]]; then
155155 # 1st run preserves as much as possible, but excludes the root directory
156156 rsync -aAhHSxz -r --exclude=lost+found --itemize-changes --info=stats2,misc2 --files-from=/tmp/filelist.txt ${SOURCE} / rsync://127.0.0.1:$STUNNEL_LISTEN_PORT /data | tee /tmp/rsync-full.log
157+ rc_a=$?
158+
159+ if [[ $rc_a -eq 0 ]]; then
160+ # Symlinks - if any symlinks were created or modified, create a control file containing the list of symlinks
161+ # Symlinks in rsync --itemize-changes output are prefixed with 'cL' when sent to rsync daemon
162+ grep -E ' ^cL' /tmp/rsync-full.log | awk -F' -> ' ' {print $1}' | sed ' s/^[^ ]* //' >> /tmp/symlink-munging-file
163+ if [[ -s /tmp/symlink-munging-file ]]; then
164+ echo " Symlinks were created or modified, sending symlink munging file to destination..."
165+ rsync /tmp/symlink-munging-file rsync://127.0.0.1:$STUNNEL_LISTEN_PORT /control/symlink-munging-file
166+ rc_a=$?
167+ fi
168+ fi
157169 else
158170 echo " Skipping sync of empty source directory"
159- fi
160- rc_a=$?
161-
162- if [[ $rc_a -eq 0 ]]; then
163- # Symlinks - if any symlinks were created or modified, create a control file containing the list of symlinks
164- # Symlinks in rsync --itemize-changes output are prefixed with 'cL' when sent to rsync daemon
165- grep -E ' ^cL' /tmp/rsync-full.log | awk -F' -> ' ' {print $1}' | sed ' s/^[^ ]* //' >> /tmp/symlink-munging-file
166- if [[ -s /tmp/symlink-munging-file ]]; then
167- echo " Symlinks were created or modified, sending symlink munging file to destination..."
168- rsync /tmp/symlink-munging-file rsync://127.0.0.1:$STUNNEL_LISTEN_PORT /control/symlink-munging-file
169- rc_a=$?
170- fi
171+ rc_a=0
171172 fi
172173
173174 # To delete extra files, must sync at the directory-level, but need to avoid
0 commit comments