detect interruption, skip rotation

This commit is contained in:
Vincent Riquer 2011-11-15 19:48:37 +01:00
parent 8aa355421d
commit b3a7fa44c9

View File

@ -129,6 +129,10 @@ rotateBackup() {
then
echo "Previous backup failed, skipping rotation."
rm "$SNAPSHOT_RW/$NAME/daily.0"
elif [ -f "$SNAPSHOT_RW/$NAME/daily.0/unfinished.remote-backup" ]
then
echo "Previous backup interrupted, skipping rotation."
rm "$SNAPSHOT_RW/$NAME/daily.0/unfinished.remote-backup"
else
# step 1: delete the oldest snapshot, if it exists:
if [ -d "$SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE}" ]
@ -175,7 +179,11 @@ runBackup() {
$RSYNC \
$RSYNC_OPTS \
"${REMOTE_LOCATION}" \
"$SNAPSHOT_RW/$NAME/$1"
"$SNAPSHOT_RW/$NAME/$1" \
|| if [ -d "$SNAPSHOT_RW/$NAME/$1" ]
then
touch "$SNAPSHOT_RW/$NAME/$1/unfinished.remote-backup"
fi
# step 5: update the mtime of daily.0 to reflect the snapshot time
$TOUCH "$SNAPSHOT_RW/$NAME/$1"