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 # # show if we shall remove partial backup, and whether the last one
# is incomplete or not # # is incomplete or not
# # #
# FIXME: test general for incomplete and decide only for warn|delete based on option? # # 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 # # 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? # # a while loop? Is it senseful to remove _ALL_ backups if non is complete?
if [ -f "$c_incomplete" ]; then # if [ -f "$c_incomplete" ]; then
last_dir=$(ls -d "$c_dest/${INTERVAL}."?* 2>/dev/null | sort -n | tail -n 1) # last_dir=$(ls -d "$c_dest/${INTERVAL}."?* 2>/dev/null | sort -n | tail -n 1)
#
# check whether the last backup was incomplete # # check whether the last backup was incomplete
# STOPPED HERE # # STOPPED HERE
# todo: implement rm -rf, implement warning on non-cleaning # # todo: implement rm -rf, implement warning on non-cleaning
# implement the marknig and normal removing # # implement the marknig and normal removing
if [ "$last_dir" ]; then # if [ "$last_dir" ]; then
incomplete=$(cd "$last_dir" && ls .ccollect-????-??-) # incomplete=$(cd "$last_dir" && ls .ccollect-????-??-)
if [ "$incomplete" ]; then # if [ "$incomplete" ]; then
"Removing incomplete backup $last_dir ..." # "Removing incomplete backup $last_dir ..."
echo rm -rf $VVERBOSE "$last_dir" # echo rm -rf $VVERBOSE "$last_dir"
fi # fi
fi # 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}.$$"