From e917546ad194bf11be3c2825909bf472698e9a14 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 17 Jan 2007 09:39:23 +0100 Subject: [PATCH] introduce old backup matching But this is definitly the WRONG way. We cannot, we need not and we MUST NOT try to catch dumb users. Instead we are the program, we may give the rules. And if we add a fancy feature and the user is too dumb to use it, it is HER/HIS fault. Just to remind my self: Add use of other backup intervals as source for this interval with the following behaviour: - locate all possible intervals in * default configuration * source specific configuration - locate all backups for each interval, record only the timestamp: * taeglich.2007-01-23-0042 -> possible_old_sources += taeglich -> taeglich_last=2007-01-23-0042 - NO READ NEED for this! other method: * sort by time, ALL possible backup: - does posix-ls support this? CHECK! - ( cd $C_SOURCE/destination/; ls --sort-by-time "$interval1".* "$interval2".* | tail -n1 ) - catches all possible intervals - add optional behaviour: * prefer other interval (newer) over this one --- ccollect.sh | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/ccollect.sh b/ccollect.sh index f21e430..f580d60 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -20,13 +20,33 @@ HALF_VERSION="ccollect $VERSION" FULL_VERSION="ccollect $VERSION ($RELEASE)" # -# Date +# Date + Markup # CDATE: how we use it for naming of the archives # DDATE: how the user should see it in our output +# MDATE: how to match (shell expression) the date # CDATE="date +%Y-%m-%d-%H%M" DDATE="date" +# FIXME: match only numbers! +MDATE="*-*-*-*" +MSUFFIX="${MDATE}.*" +echo $MSUFFIX "$MSUFFIX" +exit 1 + +# +# Fur future releases... +# Date matching: +# +# [1-9][0-9][0-9][0-9] - allow years from 1000 until 9999 - the human race will +# die earlier than this value is reached +# +# - +# [0-1][0-9] ... +# +# + + # # unset parallel execution # @@ -273,7 +293,7 @@ while [ "$i" -lt "$no_sources" ]; do echo "Finished ${c_pre_exec}." if [ "$ret" -ne 0 ]; then - echo "$c_pre_exec failed. Skipping" + echo "$c_pre_exec failed. Skipping." exit 1 fi fi @@ -284,7 +304,7 @@ while [ "$i" -lt "$no_sources" ]; do c_interval="$(cat "$backup/intervals/$INTERVAL" 2>/dev/null)" if [ -z "$c_interval" ]; then - c_interval=$D_INTERVAL + c_interval="$D_INTERVAL" if [ -z "$c_interval" ]; then echo "No definition for interval \"$INTERVAL\" found. Skipping." @@ -301,7 +321,7 @@ while [ "$i" -lt "$no_sources" ]; do else source=$(cat "$c_source") if [ $? -ne 0 ]; then - echo "Skipping: Source $c_source is not readable" + echo "Source $c_source is not readable. Skipping." exit 1 fi fi @@ -355,6 +375,8 @@ while [ "$i" -lt "$no_sources" ]; do # 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)