skip rotation if previous run failed (daily.0 is a ordinary file)

This commit is contained in:
Vincent Riquer 2011-06-08 22:17:32 +02:00
parent c2e0f9acb2
commit 61d1013c80

View File

@ -99,6 +99,11 @@ do
# rotating snapshots of /home (fixme: this should be more general) # rotating snapshots of /home (fixme: this should be more general)
if [ -f "$SNAPSHOT_RW/$NAME/daily.0" ]
then
echo "Previous backup failed, skipping rotation."
rm "$SNAPSHOT_RW/$NAME/daily.0"
else
# step 1: delete the oldest snapshot, if it exists: # step 1: delete the oldest snapshot, if it exists:
if [ -d "$SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE}" ] if [ -d "$SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE}" ]
then then
@ -114,6 +119,7 @@ do
"$SNAPSHOT_RW/$NAME/daily.$((${backup_number}+1))" "$SNAPSHOT_RW/$NAME/daily.$((${backup_number}+1))"
fi fi
done done
fi
# step 3: rsync from the system, linking to latest snapshot if files are # step 3: rsync from the system, linking to latest snapshot if files are
# identical. # identical.