diff options
-rw-r--r-- | files/handlers/rsync | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/files/handlers/rsync b/files/handlers/rsync index 471c8ba..b3f0782 100644 --- a/files/handlers/rsync +++ b/files/handlers/rsync @@ -323,6 +323,14 @@ function rotate_short { $nice $cp -alf /$folder.1/. /$folder.0 fi + # Cleanup orphaned metadata + for file in `ls $metadata`; do + if [ ! -d "`dirname $folder`/$file" ]; then + debug "removing orphaned metadata $file" + rm -rf $metadata/$file + fi + done + } function rotate_short_remote { @@ -361,6 +369,14 @@ function rotate_short_remote { if [ -d $folder.1 ]; then $nice $cp -alf /$folder.1/. /$folder.0 fi + + # Cleanup orphaned metadata + for file in `ls $metadata`; do + if [ ! -d "`dirname $folder`/\$file" ]; then + debug "removing orphaned metadata \$file" + rm -rf $metadata/\$file + fi + done ##### END REMOTE SCRIPT ####### EOF ) | (while read a; do passthru $a; done) @@ -472,6 +488,14 @@ function rotate_long { done done + # Cleanup orphaned metadata + for file in `ls $backuproot/metadata`; do + if [ ! -d "$backuproot/$file" ]; then + debug "removing orphaned metadata $file" + rm -rf $backuproot/metadata/$file + fi + done + } function rotate_long_remote { @@ -581,6 +605,14 @@ function rotate_long_remote { fi done done + + # Cleanup orphaned metadata + for file in `ls $backuproot/metadata`; do + if [ ! -d "$backuproot/\$file" ]; then + debug "removing orphaned metadata \$file" + rm -rf $backuproot/metadata/\$file + fi + done ##### END REMOTE SCRIPT ####### EOF ) | (while read a; do passthru $a; done) |