Compare commits

..

No commits in common. "fb6a2e901413244910d9e85f07fffca32c51d5ee" and "5af5a064a92ba7bfde93412ec1e5d3350fc49d0d" have entirely different histories.

View File

@ -461,13 +461,6 @@ export logFile="$logFile"
### Export docker container startup timeout variable
export COMPOSE_HTTP_TIMEOUT=${dockerStartTimeout}
## Get docker volume paths on filesystem
dockerVolumeMail=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_vmail-vol-1)
dockerVolumeRspamd=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_rspamd-vol-1)
dockerVolumePostfix=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_postfix-vol-1)
dockerVolumeRedis=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_redis-vol-1)
dockerVolumeCrypt=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_crypt-vol-1)
### Create sqlDump temporary directory and sqlDumpFile name
sqlDumpDir=$( mktemp -d )
@ -585,29 +578,12 @@ checkExist fs "$sqlDumpDir/$sqlDumpFile"
fi
### Save redis state
## Delete any existing redis dump file otherwise our check will be useless
echo -e "${op}${stamp} Cleaning up old redis state backup...${normal}" \
>> "$logFile"
checkExist ff "$dockerVolumeRedis/dump.rdb"
checkResult="$?"
if [ "$checkResult" = "0" ]
echo -e "${lit}${stamp} Old redis backup found.${normal}" >> "$logFile"
echo -e "${op}Deleting...${normal}" >> "$logFile"
rm -f "$dockerVolumeRedis/dump.rdb" 2>> "$logFile"
echo -e "${op}${stamp}...done${normal}" >> "$logFile"
else
echo -e "${op}${stamp} No old redis backup found${normal}" \
>> "$logFile"
fi
## Export redis
echo -e "${op}${stamp} Saving redis state information...${normal}" >> "$logFile"
docker-compose exec redis-mailcow redis-cli save >> "$logFile" 2>&1
## although redis returns an 'OK' if successful, seemingly nothing can test for
## this... so let's just verify the dump file was written to disk
checkExist fs "$dockerVolumeRedis/dump.rdb"
checkResult="$?"
if [ "$checkResult" = "0" ]; then
echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \
## redis outputs a simple 'OK' if the export succeeded, so check the log file
## for a line just written that says that specifically
if [ $(tail -1 "$logFile") = "OK" ];
echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \
>> "$logFile"
else
exitError+=("${stamp}_202")
@ -771,6 +747,14 @@ fi
export TMPDIR="${BORG_BASE_DIR}/tmp"
## Get docker volume paths on filesystem for inclusion in backup
dockerVolumeMail=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_vmail-vol-1)
dockerVolumeRspamd=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_rspamd-vol-1)
dockerVolumePostfix=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_postfix-vol-1)
dockerVolumeRedis=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_redis-vol-1)
dockerVolumeCrypt=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_crypt-vol-1)
## Generate and execute borg
# commandline depends on whether borgExclude is empty or not
if [ -z "$borgExclude" ]; then