catch if tmp dir cannot be removed

This commit is contained in:
Asif Bacchus 2020-03-26 04:01:15 -06:00
parent 5254dba0bf
commit 7f2f054ebc
1 changed files with 3 additions and 1 deletions

View File

@ -11,7 +11,9 @@ trap trapExit 1 2 3 6
cleanup () {
# remove borg temp directory, if it exists
if [ -d "${borgBaseDir}/tmp" ]; then
rm -rf "${borgBaseDir}/tmp" > /dev/null 2>&1
if ! rm -rf "${borgBaseDir}/tmp" > /dev/null 2>&1; then
consoleError 9 "Script completed successfully but could not remove temporary directory at $borgBaseDir/tmp. Sorry to be messy."
fi
fi
}