aboutsummaryrefslogtreecommitdiff
path: root/handlers/rsync.in
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-01-03 18:54:58 -0200
committerintrigeri <intrigeri@boum.org>2012-01-04 22:48:41 +0100
commitdb45b98132b352bc651f5ee0eb7299919eceb31a (patch)
treebcc01bdeb6b6cd00c774e6fb90cc8754e66c5002 /handlers/rsync.in
parentfb393b49c55c48023f9cd1d0f36a6fb60ae5b97f (diff)
downloadbackupninja-db45b98132b352bc651f5ee0eb7299919eceb31a.tar.gz
backupninja-db45b98132b352bc651f5ee0eb7299919eceb31a.tar.bz2
Cleanup orphaned metadata (#3727)
Diffstat (limited to 'handlers/rsync.in')
-rw-r--r--handlers/rsync.in32
1 files changed, 32 insertions, 0 deletions
diff --git a/handlers/rsync.in b/handlers/rsync.in
index ab6496f..f140642 100644
--- a/handlers/rsync.in
+++ b/handlers/rsync.in
@@ -317,6 +317,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 {
@@ -355,6 +363,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)
@@ -466,6 +482,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 {
@@ -575,6 +599,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)