feature(RESTORE): abort if mc not pre-initialized

This commit is contained in:
Asif Bacchus 2021-02-08 08:46:14 -07:00
parent 7ce419d3eb
commit 1d793dc291

View File

@ -300,7 +300,11 @@ printf "%s[%s] -- [INFO] Using REDIS volume: %s --%s\n" \
dockerVolumeCrypt=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_crypt-vol-1) dockerVolumeCrypt=$(docker volume inspect -f '{{ .Mountpoint }}' ${COMPOSE_PROJECT_NAME}_crypt-vol-1)
printf "%s[%s] -- [INFO] Using MAILCRYPT volume: %s --%s\n" \ printf "%s[%s] -- [INFO] Using MAILCRYPT volume: %s --%s\n" \
"$cyan" "$(stamp)" "$dockerVolumeCrypt" "$norm" >>"$logfile" "$cyan" "$(stamp)" "$dockerVolumeCrypt" "$norm" >>"$logfile"
# exit if mail or crypt containers cannot be found (mailcow not initialized beforehand)
if [ -z $dockerVolumeMail ] || [ -z $dockerVolumeCrypt ]; then
writeLog 'error' '5' "Cannot find mail volume. Mailcow probably not initialized before running restore."
exitError 5
fi
#TODO: stop containers #TODO: stop containers
#TODO: copy backups to correct docker volumes #TODO: copy backups to correct docker volumes
@ -324,6 +328,7 @@ exit 0
# 1: parameter error # 1: parameter error
# 2: not run as root # 2: not run as root
# 3: docker not installed # 3: docker not installed
# 5: mailcow not initialized before running script
# 99: TERM signal trapped # 99: TERM signal trapped
# 100: could not change to mailcow-dockerized directory # 100: could not change to mailcow-dockerized directory
# 101: could not stop container(s) # 101: could not stop container(s)