From 8a5a87db126eb068b3adc5b31a3e4094c48738ab Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Wed, 6 May 2020 22:57:41 -0600 Subject: [PATCH] add SQL directory to cleanup --- .vscode/numbered-bookmarks.json | 18 +----------------- backup/backup.sh | 12 +++++++++++- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index 03ed6a9..4c08963 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -1,19 +1,3 @@ { - "bookmarks": [ - { - "fsPath": "$ROOTPATH$/backup/backup.sh", - "bookmarks": [ - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - 352 - ] - } - ] + "bookmarks": [] } \ No newline at end of file diff --git a/backup/backup.sh b/backup/backup.sh index c5461b2..612c771 100644 --- a/backup/backup.sh +++ b/backup/backup.sh @@ -71,7 +71,7 @@ badParam () { # cleanup cleanup () { - # cleanup 503 if copied + # cleanup 503 if copied if [ "$err503Copied" -eq 1 ]; then if ! rm -f "$webroot/$err503File" 2>>"$logFile"; then printf "%s[%s] -- [WARNING] Could not remove 503 error page." \ @@ -85,6 +85,16 @@ cleanup () { "$cyan" "$(stamp)" "$norm" >> "$logFile" fi fi + # cleanup SQL dump directory if created + if [ "$sqlDumpDirCreated" -eq 1 ]; then + if ! rm -rf "$sqlDumpDir" 2>>"$logFile"; then + printf "%s[%s] -- [WARNING] Could not remove temporary SQL-dump directory. Sorry for the mess. --%s\n" \ + "$warn" "$(stamp)" "$norm" >> "$logFile" + else + printf "%s[%s] -- [INFO] Temporary SQL-dump directory removed successfully --%s\n" \ + "$cyan" "$(stamp)" "$norm" >> "$logFile" + fi + fi } # call cleanup and then exit with error report