diff --git a/backup/backup.sh b/backup/backup.sh index 3fb7409..01b855b 100755 --- a/backup/backup.sh +++ b/backup/backup.sh @@ -545,6 +545,18 @@ exclusions=1 fi +### set location of sql dump +# this is done before resetting default TMP dir for borg +if ! sqlDumpDir=$( mktemp -d 2>/dev/null ); then + exitError 115 'Unable to create temp directory for SQL dump.' +else + sqlDumpFile="backup-$( date +%Y%m%d_%H%M%S ).sql" + sqlDumpDirCreated=1 + printf "%s[%s] -- [INFO] SQL dump file will be stored at: %s --%s\n" \ + "$cyan" "$(stamp)" "$sqlDumpDir/$sqlDumpFile" "$norm" >> "$logFile" +fi + + ### create borg temp dir: ## python requires a writable temporary directory when unpacking borg and ## executing commands. This defaults to /tmp but many systems mount /tmp with @@ -564,17 +576,6 @@ fi export TMPDIR="${borgBaseDir}/tmp" -### set location of sql dump -if ! sqlDumpDir=$( mktemp -d 2>/dev/null ); then - exitError 115 'Unable to create temp directory for SQL dump.' -else - sqlDumpFile="backup-$( date +%Y%m%d_%H%M%S ).sql" - sqlDumpDirCreated=1 - printf "%s[%s] -- [INFO] SQL dump file will be stored at: %s --%s\n" \ - "$cyan" "$(stamp)" "$sqlDumpDir/$sqlDumpFile" "$norm" >> "$logFile" -fi - - ### 503 functionality if [ "$use503" -eq 1 ]; then printf "%s[%s] -- [INFO] Copying 503 error page to " \