Delete in background
This commit is contained in:
parent
3f0f29798b
commit
5f44b890c7
@ -189,8 +189,15 @@ rotateBackup() {
|
|||||||
# 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
|
||||||
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\tDeleting $SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE}"
|
origin="$SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE}"
|
||||||
$RM -rf "$SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE}"
|
dest="$SNAPSHOT_RW/$NAME/delete.daily.${MAX_ROTATE}"
|
||||||
|
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\tDeleting $origin"
|
||||||
|
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\t\tMoving" \
|
||||||
|
"$origin to $dest"
|
||||||
|
$MV "$origin" "$dest"
|
||||||
|
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\t\tDeleting" \
|
||||||
|
"$dest"
|
||||||
|
$RM -rf "$dest" &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# step 2: shift the snapshots(s) back by one, if they exist
|
# step 2: shift the snapshots(s) back by one, if they exist
|
||||||
@ -211,8 +218,15 @@ rotateBackup() {
|
|||||||
then
|
then
|
||||||
if [ -d "$SNAPSHOT_RW/$NAME/weekly.${WEEK_KEEP}" ]
|
if [ -d "$SNAPSHOT_RW/$NAME/weekly.${WEEK_KEEP}" ]
|
||||||
then
|
then
|
||||||
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\tDeleting $SNAPSHOT_RW/$NAME/weekly.${WEEK_KEEP}"
|
origin="$SNAPSHOT_RW/$NAME/weekly.${WEEK_KEEP}"
|
||||||
$RM -rf "$SNAPSHOT_RW/$NAME/weekly.${WEEK_KEEP}"
|
dest="$SNAPSHOT_RW/$NAME/delete.weekly.${WEEK_KEEP}"
|
||||||
|
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\tDeleting $origin"
|
||||||
|
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\t\tMoving" \
|
||||||
|
"$origin to $dest"
|
||||||
|
$MV "$origin" "$dest"
|
||||||
|
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\t\tDeleting" \
|
||||||
|
"$dest"
|
||||||
|
$RM -rf "$dest" &
|
||||||
fi
|
fi
|
||||||
for (( backup_num=$WEEK_KEEP ; backup_num >= 0 ; backup_num-- ))
|
for (( backup_num=$WEEK_KEEP ; backup_num >= 0 ; backup_num-- ))
|
||||||
do
|
do
|
||||||
@ -237,8 +251,15 @@ rotateBackup() {
|
|||||||
then
|
then
|
||||||
if [ -d "$SNAPSHOT_RW/$NAME/monthly.${MONTH_KEEP}" ]
|
if [ -d "$SNAPSHOT_RW/$NAME/monthly.${MONTH_KEEP}" ]
|
||||||
then
|
then
|
||||||
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\tDeleting $SNAPSHOT_RW/$NAME/monthly.${MONTH_KEEP}"
|
origin="$SNAPSHOT_RW/$NAME/monthly.${MONTH_KEEP}"
|
||||||
$RM -rf "$SNAPSHOT_RW/$NAME/monthly.${MONTH_KEEP}"
|
dest="$SNAPSHOT_RW/$NAME/delete.monthly.${MONTH_KEEP}"
|
||||||
|
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\tDeleting $origin"
|
||||||
|
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\t\tMoving" \
|
||||||
|
"$origin to $dest"
|
||||||
|
$MV "$origin" "$dest"
|
||||||
|
echo -e "$(date +%Y-%m-%d:%H:%M:%S)\t\t\tDeleting" \
|
||||||
|
"$dest"
|
||||||
|
$RM -rf "$dest" &
|
||||||
fi
|
fi
|
||||||
for (( backup_num=$MONTH_KEEP ; backup_num >= 0 ; backup_num-- ))
|
for (( backup_num=$MONTH_KEEP ; backup_num >= 0 ; backup_num-- ))
|
||||||
do
|
do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user