Delete in background and finally wait for children

This commit is contained in:
Darko Poljak 2019-10-16 14:03:13 +02:00
parent ca6d06c2c3
commit 30abef474d

View file

@ -711,7 +711,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
if [ "$ret" -eq 0 ]; then if [ "$ret" -eq 0 ]; then
_techo "Incomplete backups: $(echo $(cat "${TMP}"))" _techo "Incomplete backups: $(echo $(cat "${TMP}"))"
if [ -f "${c_delete_incomplete}" ]; then if [ -f "${c_delete_incomplete}" ]; then
delete_from_file "${TMP}" "${CMARKER}" delete_from_file "${TMP}" "${CMARKER}" &
fi fi
fi fi
@ -729,7 +729,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
ls -${TSORT}1r | grep "^${INTERVAL}\\." | head -n "${remove}" > "${TMP}" || \ ls -${TSORT}1r | grep "^${INTERVAL}\\." | head -n "${remove}" > "${TMP}" || \
_exit_err "Listing old backups failed" _exit_err "Listing old backups failed"
delete_from_file "${TMP}" delete_from_file "${TMP}" &
fi fi
# #
@ -820,6 +820,9 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
_techo "Backup lasted: ${hours}:${minutes}:${seconds} (h:m:s)" _techo "Backup lasted: ${hours}:${minutes}:${seconds} (h:m:s)"
unlock "${name}" unlock "${name}"
# wait for children (doing delete_from_file) if any still running
wait
) || exit ) || exit
done done