From c9b85d084efbf81cd8c088b0a607ba0b570aaea5 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Mon, 8 Feb 2021 11:30:39 -0700 Subject: [PATCH] feature(RESTORE): stop docker containers and confirm --- backup/restore.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backup/restore.sh b/backup/restore.sh index bbb563d..4617d3e 100644 --- a/backup/restore.sh +++ b/backup/restore.sh @@ -346,7 +346,16 @@ if [ "$restoreSQL" -eq 1 ]; then fi fi -#TODO: stop containers +### stop containers (necessary for all restore operations except SQL) +if ! docker-compose down > /dev/null 2>&1; then + writeLog 'error' '20' "Unable to bring mailcow containers down -- cannot reliably restore. Aborting." + exitError 20 +fi +if [ "$( docker ps --filter "name=${COMPOSE_PROJECT_NAME}" -q | wc -l )" -gt 0 ]; then + writeLog 'error' '20' "Unable to bring mailcow containers down -- cannot reliably restore. Aborting." + exitError 20 +fi + #TODO: copy backups to correct docker volumes #TODO: restart docker containers #TODO: optionally reindex dovecot (parameter)