From d6ea94c6dcc86e3ade57895a3c1a5c50cb05358b Mon Sep 17 00:00:00 2001 From: jll2 Date: Mon, 15 Jun 2009 20:16:25 -0700 Subject: [PATCH] Fix delete_incomplete bugs: 1). On systems I tried, delete_incomplete failed because the line: < pcmd rm $VVERBOSE -rf "${ddir}/${realincomplete}" || \ should read: > pcmd rm $VVERBOSE -rf "${realincomplete}" || \ (Is this true of all systems?) 2). The marker file was not deleted. Code was added to delete it. 3). The delete_incomplete code was simplified. --- ccollect.sh | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/ccollect.sh b/ccollect.sh index e93956d..d6831bc 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -442,24 +442,16 @@ while [ "${i}" -lt "${no_sources}" ]; do # # Check for incomplete backups # - pcmd ls -1 "$ddir/${INTERVAL}"*".${c_marker}" > "${TMP}" 2>/dev/null - - i=0 - while read incomplete; do - eval incomplete_$i=\"$(echo ${incomplete} | sed "s/\\.${c_marker}\$//")\" - i=$(($i+1)) - done < "${TMP}" - - j=0 - while [ "$j" -lt "$i" ]; do - eval realincomplete=\"\$incomplete_$j\" - _techo "Incomplete backup: ${realincomplete}" + pcmd ls -1 "$ddir/${INTERVAL}"*".${c_marker}" 2>/dev/null | while read marker; do + incomplete="$(echo ${marker} | sed "s/\\.${c_marker}\$//")" + _techo "Incomplete backup: ${incomplete}" if [ -f "${c_delete_incomplete}" ]; then - _techo "Deleting ${realincomplete} ..." - pcmd rm $VVERBOSE -rf "${ddir}/${realincomplete}" || \ - _exit_err "Removing ${realincomplete} failed." + _techo "Deleting ${incomplete} ..." + pcmd rm $VVERBOSE -rf "${incomplete}" || \ + _exit_err "Removing ${incomplete} failed." + pcmd rm $VVERBOSE -f "${marker}" || \ + _exit_err "Removing ${marker} failed." fi - j=$(($j+1)) done #