move sql dump earlier in script

Borg requires the default TMP dir be changed to avoid permissions issue.
Moving earlier means SQL dumps to system default TMP location.
This commit is contained in:
Asif Bacchus 2020-05-07 00:58:27 -06:00
parent 51928d4327
commit 09c1d903ba

View File

@ -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 " \