From 7f2f054ebcf804e414f9c907e571e8cc347c4b79 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Thu, 26 Mar 2020 04:01:15 -0600 Subject: [PATCH] catch if tmp dir cannot be removed --- borghelper.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/borghelper.sh b/borghelper.sh index cddaab0..0c82ff6 100755 --- a/borghelper.sh +++ b/borghelper.sh @@ -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 }