Remove experiemental

This commit is contained in:
Nico Schottelius 2007-01-17 19:32:21 +01:00
parent 07cb3473db
commit 7c53c28c5d

View file

@ -372,29 +372,29 @@ while [ "$i" -lt "$no_sources" ]; do
VVERBOSE="-v" VVERBOSE="-v"
fi fi
# #
# # show if we shall remove partial backup, and whether the last one
# # is incomplete or not
# #
# # FIXME: test general for incomplete and decide only for warn|delete based on option?
# # FIXME: Define which is the last dir before? Or put this thing into
# # a while loop? Is it senseful to remove _ALL_ backups if non is complete?
# if [ -f "$c_incomplete" ]; then
# last_dir=$(ls -d "$c_dest/${INTERVAL}."?* 2>/dev/null | sort -n | tail -n 1)
# #
# show if we shall remove partial backup, and whether the last one # # check whether the last backup was incomplete
# is incomplete or not # # STOPPED HERE
# # todo: implement rm -rf, implement warning on non-cleaning
# # implement the marknig and normal removing
# if [ "$last_dir" ]; then
# incomplete=$(cd "$last_dir" && ls .ccollect-????-??-)
# if [ "$incomplete" ]; then
# "Removing incomplete backup $last_dir ..."
# echo rm -rf $VVERBOSE "$last_dir"
# fi
# fi
# fi
# #
# FIXME: test general for incomplete and decide only for warn|delete based on option?
# FIXME: Define which is the last dir before? Or put this thing into
# a while loop? Is it senseful to remove _ALL_ backups if non is complete?
if [ -f "$c_incomplete" ]; then
last_dir=$(ls -d "$c_dest/${INTERVAL}."?* 2>/dev/null | sort -n | tail -n 1)
# check whether the last backup was incomplete
# STOPPED HERE
# todo: implement rm -rf, implement warning on non-cleaning
# implement the marknig and normal removing
if [ "$last_dir" ]; then
incomplete=$(cd "$last_dir" && ls .ccollect-????-??-)
if [ "$incomplete" ]; then
"Removing incomplete backup $last_dir ..."
echo rm -rf $VVERBOSE "$last_dir"
fi
fi
fi
# #
# check if maximum number of backups is reached, if so remove # check if maximum number of backups is reached, if so remove
# #
@ -409,7 +409,7 @@ while [ "$i" -lt "$no_sources" ]; do
remove=$(($count - $substract)) remove=$(($count - $substract))
echo "Removing $remove backup(s)..." echo "Removing $remove backup(s)..."
ls -d "$c_dest/${INTERVAL}."?* | sort -n | head -n $remove > "$TMP" ls -d "$c_dest/${INTERVAL}."?* | sort -n | head -n "$remove" > "$TMP"
#( cd "$c_dest" && ls -p1 | grep "^${INTERVAL}\..*/\$" | sort -n | head -n $remove > "$TMP" #( cd "$c_dest" && ls -p1 | grep "^${INTERVAL}\..*/\$" | sort -n | head -n $remove > "$TMP"
while read to_remove; do while read to_remove; do
dir="$to_remove" dir="$to_remove"
@ -422,6 +422,8 @@ while [ "$i" -lt "$no_sources" ]; do
# clone the old directory with hardlinks # clone the old directory with hardlinks
# #
# FIXME: STOPPED
destination_date=$($CDATE) destination_date=$($CDATE)
destination_dir="$c_dest/${INTERVAL}.${destination_date}.$$" destination_dir="$c_dest/${INTERVAL}.${destination_date}.$$"