simplify backup count code
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
0d5b2992c0
commit
093de8b0a1
1 changed files with 2 additions and 3 deletions
5
ccollect
5
ccollect
|
@ -440,7 +440,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
|
||||||
#
|
#
|
||||||
# Check incomplete backups (needs echo to remove newlines)
|
# 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"
|
_exit_err "Cannot list incomplete files"
|
||||||
|
|
||||||
_techo "Incomplete backups: $(echo $(cat "${TMP}"))"
|
_techo "Incomplete backups: $(echo $(cat "${TMP}"))"
|
||||||
|
@ -451,8 +451,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
|
||||||
#
|
#
|
||||||
# Check: maximum number of backups is reached?
|
# Check: maximum number of backups is reached?
|
||||||
#
|
#
|
||||||
# FIXME: simplify, grep, cd? => no star, does not get expanded on failure
|
count="$(ls -1 | grep "^${INTERVAL}\\." | wc -l | sed 's/^ *//g')" \
|
||||||
count="$(pcmd ls -d1 "${ddir}/${INTERVAL}."*"/" | wc -l | sed 's/^ *//g')" \
|
|
||||||
|| _exit_err "Counting backups failed"
|
|| _exit_err "Counting backups failed"
|
||||||
|
|
||||||
_techo "Existing backups: ${count} Total keeping backups: ${c_interval}"
|
_techo "Existing backups: ${count} Total keeping backups: ${c_interval}"
|
||||||
|
|
Loading…
Reference in a new issue