Compare commits
2 Commits
5af5a064a9
...
fb6a2e9014
Author | SHA1 | Date | |
---|---|---|---|
|
fb6a2e9014 | ||
|
6b91b93738 |
@ -461,6 +461,13 @@ export logFile="$logFile"
|
|||||||
### Export docker container startup timeout variable
|
### Export docker container startup timeout variable
|
||||||
export COMPOSE_HTTP_TIMEOUT=${dockerStartTimeout}
|
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
|
### Create sqlDump temporary directory and sqlDumpFile name
|
||||||
sqlDumpDir=$( mktemp -d )
|
sqlDumpDir=$( mktemp -d )
|
||||||
@ -578,12 +585,29 @@ checkExist fs "$sqlDumpDir/$sqlDumpFile"
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### Save redis state
|
### 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"
|
echo -e "${op}${stamp} Saving redis state information...${normal}" >> "$logFile"
|
||||||
docker-compose exec redis-mailcow redis-cli save >> "$logFile" 2>&1
|
docker-compose exec redis-mailcow redis-cli save >> "$logFile" 2>&1
|
||||||
## redis outputs a simple 'OK' if the export succeeded, so check the log file
|
## although redis returns an 'OK' if successful, seemingly nothing can test for
|
||||||
## for a line just written that says that specifically
|
## this... so let's just verify the dump file was written to disk
|
||||||
if [ $(tail -1 "$logFile") = "OK" ];
|
checkExist fs "$dockerVolumeRedis/dump.rdb"
|
||||||
echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \
|
checkResult="$?"
|
||||||
|
if [ "$checkResult" = "0" ]; then
|
||||||
|
echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
else
|
else
|
||||||
exitError+=("${stamp}_202")
|
exitError+=("${stamp}_202")
|
||||||
@ -747,14 +771,6 @@ fi
|
|||||||
export TMPDIR="${BORG_BASE_DIR}/tmp"
|
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
|
## Generate and execute borg
|
||||||
# commandline depends on whether borgExclude is empty or not
|
# commandline depends on whether borgExclude is empty or not
|
||||||
if [ -z "$borgExclude" ]; then
|
if [ -z "$borgExclude" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user