Compose Version detection implemented in Backup script
This commit is contained in:
parent
6708059227
commit
925b220905
@ -160,12 +160,24 @@ function backup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function restore() {
|
function restore() {
|
||||||
for bin in docker docker-compose; do
|
for bin in docker; do
|
||||||
if [[ -z $(which ${bin}) ]]; then
|
if [[ -z $(which ${bin}) ]]; then
|
||||||
>&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
|
>&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "${DOCKER_COMPOSE_VERSION}" == "native" ]; then
|
||||||
|
COMPOSE_COMMAND="docker compose"
|
||||||
|
|
||||||
|
elif [ "${DOCKER_COMPOSE_VERSION}" == "standalone" ]; then
|
||||||
|
COMPOSE_COMMAND="docker-compose"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo -e "\e[31mCan not read DOCKER_COMPOSE_VERSION variable from mailcow.conf! Is your mailcow up to date? Exiting...\e[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Stopping watchdog-mailcow..."
|
echo "Stopping watchdog-mailcow..."
|
||||||
docker stop $(docker ps -qf name=watchdog-mailcow)
|
docker stop $(docker ps -qf name=watchdog-mailcow)
|
||||||
@ -244,7 +256,7 @@ function restore() {
|
|||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
echo "Stopping mailcow..."
|
echo "Stopping mailcow..."
|
||||||
docker-compose -f ${COMPOSE_FILE} --env-file ${ENV_FILE} down
|
${COMPOSE_COMMAND} -f ${COMPOSE_FILE} --env-file ${ENV_FILE} down
|
||||||
fi
|
fi
|
||||||
#docker stop $(docker ps -qf name=mysql-mailcow)
|
#docker stop $(docker ps -qf name=mysql-mailcow)
|
||||||
if [[ -d "${RESTORE_LOCATION}/mysql" ]]; then
|
if [[ -d "${RESTORE_LOCATION}/mysql" ]]; then
|
||||||
@ -282,7 +294,7 @@ function restore() {
|
|||||||
sed -i --follow-symlinks "/DBROOT/c\DBROOT=${DBROOT}" ${SCRIPT_DIR}/../mailcow.conf
|
sed -i --follow-symlinks "/DBROOT/c\DBROOT=${DBROOT}" ${SCRIPT_DIR}/../mailcow.conf
|
||||||
source ${SCRIPT_DIR}/../mailcow.conf
|
source ${SCRIPT_DIR}/../mailcow.conf
|
||||||
echo "Starting mailcow..."
|
echo "Starting mailcow..."
|
||||||
docker-compose -f ${COMPOSE_FILE} --env-file ${ENV_FILE} up -d
|
${COMPOSE_COMMAND} -f ${COMPOSE_FILE} --env-file ${ENV_FILE} up -d
|
||||||
#docker start $(docker ps -aqf name=mysql-mailcow)
|
#docker start $(docker ps -aqf name=mysql-mailcow)
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
20
update.sh
20
update.sh
@ -646,16 +646,16 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# echo -e "\e[32mChecking for newer update script...\e[0m"
|
echo -e "\e[32mChecking for newer update script...\e[0m"
|
||||||
# SHA1_1=$(sha1sum update.sh)
|
SHA1_1=$(sha1sum update.sh)
|
||||||
# git fetch origin #${BRANCH}
|
git fetch origin #${BRANCH}
|
||||||
# git checkout origin/${BRANCH} update.sh
|
git checkout origin/${BRANCH} update.sh
|
||||||
# SHA1_2=$(sha1sum update.sh)
|
SHA1_2=$(sha1sum update.sh)
|
||||||
# if [[ ${SHA1_1} != ${SHA1_2} ]]; then
|
if [[ ${SHA1_1} != ${SHA1_2} ]]; then
|
||||||
# echo "update.sh changed, please run this script again, exiting."
|
echo "update.sh changed, please run this script again, exiting."
|
||||||
# chmod +x update.sh
|
chmod +x update.sh
|
||||||
# exit 2
|
exit 2
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
if [ ! $FORCE ]; then
|
if [ ! $FORCE ]; then
|
||||||
read -r -p "Are you sure you want to update mailcow: dockerized? All containers will be stopped. [y/N] " response
|
read -r -p "Are you sure you want to update mailcow: dockerized? All containers will be stopped. [y/N] " response
|
||||||
|
Loading…
Reference in New Issue
Block a user