From 30abef474dea75705ee005a0453ea536e73d2fb8 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Wed, 16 Oct 2019 14:03:13 +0200 Subject: [PATCH] Delete in background and finally wait for children --- ccollect | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ccollect b/ccollect index 8e02524..7ede4dc 100755 --- a/ccollect +++ b/ccollect @@ -711,7 +711,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do if [ "$ret" -eq 0 ]; then _techo "Incomplete backups: $(echo $(cat "${TMP}"))" if [ -f "${c_delete_incomplete}" ]; then - delete_from_file "${TMP}" "${CMARKER}" + delete_from_file "${TMP}" "${CMARKER}" & fi fi @@ -729,7 +729,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do ls -${TSORT}1r | grep "^${INTERVAL}\\." | head -n "${remove}" > "${TMP}" || \ _exit_err "Listing old backups failed" - delete_from_file "${TMP}" + delete_from_file "${TMP}" & fi # @@ -820,6 +820,9 @@ while [ "${source_no}" -lt "${no_sources}" ]; do _techo "Backup lasted: ${hours}:${minutes}:${seconds} (h:m:s)" unlock "${name}" + + # wait for children (doing delete_from_file) if any still running + wait ) || exit done