From d3a14f397c95751e3151c387bbe5400efa423179 Mon Sep 17 00:00:00 2001 From: andryyy Date: Sat, 3 Oct 2020 11:11:48 +0200 Subject: [PATCH] [Helper] Allow to run backup script everywhere --- helper-scripts/backup_and_restore.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/helper-scripts/backup_and_restore.sh b/helper-scripts/backup_and_restore.sh index 42546bac..34095a40 100755 --- a/helper-scripts/backup_and_restore.sh +++ b/helper-scripts/backup_and_restore.sh @@ -51,12 +51,18 @@ fi BACKUP_LOCATION=$(echo ${BACKUP_LOCATION} | sed 's#/$##') SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" COMPOSE_FILE=${SCRIPT_DIR}/../docker-compose.yml +ENV_FILE=${SCRIPT_DIR}/../.env if [ ! -f ${COMPOSE_FILE} ]; then echo "Compose file not found" exit 1 fi +if [ ! -f ${ENV_FILE} ]; then + echo "Environment file not found" + exit 1 +fi + echo "Using ${BACKUP_LOCATION} as backup/restore location." echo @@ -219,7 +225,7 @@ function restore() { continue else echo "Stopping mailcow..." - docker-compose down + docker-compose -f ${COMPOSE_FILE} --env-file ${ENV_FILE} down fi #docker stop $(docker ps -qf name=mysql-mailcow) if [[ -d "${RESTORE_LOCATION}/mysql" ]]; then @@ -257,7 +263,7 @@ function restore() { sed -i --follow-symlinks "/DBROOT/c\DBROOT=${DBROOT}" ${SCRIPT_DIR}/../mailcow.conf source ${SCRIPT_DIR}/../mailcow.conf echo "Starting mailcow..." - docker-compose up -d + docker-compose -f ${COMPOSE_FILE} --env-file ${ENV_FILE} up -d #docker start $(docker ps -aqf name=mysql-mailcow) fi ;;