simplify backup count code

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-01-15 02:09:27 +01:00
parent 0d5b2992c0
commit 093de8b0a1

View file

@ -440,7 +440,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
#
# Check incomplete backups (needs echo to remove newlines)
#
pcmd ls -d1 "${ddir}" | grep "${CMARKER}\$" > "${TMP}" || \
ls -1 | grep "${CMARKER}\$" > "${TMP}" || \
_exit_err "Cannot list incomplete files"
_techo "Incomplete backups: $(echo $(cat "${TMP}"))"
@ -451,8 +451,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
#
# Check: maximum number of backups is reached?
#
# FIXME: simplify, grep, cd? => no star, does not get expanded on failure
count="$(pcmd ls -d1 "${ddir}/${INTERVAL}."*"/" | wc -l | sed 's/^ *//g')" \
count="$(ls -1 | grep "^${INTERVAL}\\." | wc -l | sed 's/^ *//g')" \
|| _exit_err "Counting backups failed"
_techo "Existing backups: ${count} Total keeping backups: ${c_interval}"