Prepare marking of incomplete backups

This commit is contained in:
Nico Schottelius 2006-10-25 15:16:37 +02:00
parent b31989c476
commit 735353bd05
2 changed files with 33 additions and 1 deletions

2
TODO
View file

@ -40,6 +40,8 @@
09:40 < KillerFox> aber eigentlich logisch. 09:40 < KillerFox> aber eigentlich logisch.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
sven / markierung sven / markierung
- wie seht der Marker aus?
-> .ccollect-YEAR-MM-DD.HHmm.pid (like the directory)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Add ccollect-restore.sh (new project, perhaps coordinated with jchome's Add ccollect-restore.sh (new project, perhaps coordinated with jchome's
ccollect-config) ccollect-config)

View file

@ -225,6 +225,7 @@ while [ "$i" -lt "$no_sources" ]; do
c_vverbose="$backup/very_verbose" c_vverbose="$backup/very_verbose"
c_rsync_extra="$backup/rsync_options" c_rsync_extra="$backup/rsync_options"
c_summary="$backup/summary" c_summary="$backup/summary"
c_incomplete="$backup/incomplete_remove"
c_pre_exec="$backup/pre_exec" c_pre_exec="$backup/pre_exec"
c_post_exec="$backup/post_exec" c_post_exec="$backup/post_exec"
@ -346,6 +347,25 @@ 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
#
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 ..."
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
# #
@ -383,6 +403,11 @@ while [ "$i" -lt "$no_sources" ]; do
echo "Creating $destination_dir ..." echo "Creating $destination_dir ..."
mkdir $VVERBOSE "$destination_dir" || exit 1 mkdir $VVERBOSE "$destination_dir" || exit 1
#
# FIXME: add marking here
# touch c_marker
#
# #
# make an absolute path, perhaps $CCOLLECT_CONF is relative! # make an absolute path, perhaps $CCOLLECT_CONF is relative!
# #
@ -407,7 +432,7 @@ while [ "$i" -lt "$no_sources" ]; do
# #
abs_last_dir="$(cd "$last_dir" && pwd -P)" abs_last_dir="$(cd "$last_dir" && pwd -P)"
if [ -z "$abs_last_dir" ]; then if [ -z "$abs_last_dir" ]; then
echo "Changing to the backup destination failed. I skip this backup." echo "Changing to the last backup directory failed. I skip this backup."
exit 1 exit 1
fi fi
@ -423,6 +448,11 @@ while [ "$i" -lt "$no_sources" ]; do
echo "rsync reported error $ret. The backup may be broken (see rsync errors)." echo "rsync reported error $ret. The backup may be broken (see rsync errors)."
fi fi
#
# FIXME: remove marking here
# rm -f $c_marker
#
echo "$($DDATE) Finished backup" echo "$($DDATE) Finished backup"
# #