From 4a2d621bac0d8419896e7e1be3bd5e9113f91eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B0=8F=E7=99=BD?= <296015668@qq.com> Date: Wed, 30 Oct 2024 16:20:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A4=87?= =?UTF-8?q?=E4=BB=BD=E5=8F=82=E6=95=B0=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/5_db_backup.sh | 7 ++++--- scripts/6_db_restore.sh | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/5_db_backup.sh b/scripts/5_db_backup.sh index f2b8ef71..dc1ecd26 100755 --- a/scripts/5_db_backup.sh +++ b/scripts/5_db_backup.sh @@ -8,8 +8,9 @@ VOLUME_DIR=$(get_config VOLUME_DIR) BACKUP_DIR="${VOLUME_DIR}/db_backup" CURRENT_VERSION=$(get_config CURRENT_VERSION) -DATABASE=$(get_config DB_NAME) -DB_FILE=${BACKUP_DIR}/${DATABASE}-${CURRENT_VERSION}-$(date +%F_%T).sql +DB_HOST=$(get_config DB_HOST) +DB_NAME=$(get_config DB_NAME) +DB_FILE=${BACKUP_DIR}/${DB_NAME}-${CURRENT_VERSION}-$(date +%F_%T).sql function main() { if [[ ! -d ${BACKUP_DIR} ]]; then @@ -23,7 +24,7 @@ function main() { create_db_ops_env flag=1 fi - if [[ "${HOST}" == "mysql" ]]; then + if [[ "${DB_HOST}" == "mysql" ]]; then while [[ "$(docker inspect -f "{{.State.Health.Status}}" jms_mysql)" != "healthy" ]]; do sleep 5s done diff --git a/scripts/6_db_restore.sh b/scripts/6_db_restore.sh index 22846a11..09b693d2 100755 --- a/scripts/6_db_restore.sh +++ b/scripts/6_db_restore.sh @@ -7,6 +7,8 @@ BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" DB_FILE="$1" BACKUP_DIR=$(dirname "${DB_FILE}") +DB_HOST=$(get_config DB_HOST) + function main() { echo_warn "$(gettext 'Make sure you have a backup of data, this operation is not reversible')! \n" @@ -23,7 +25,7 @@ function main() { create_db_ops_env flag=1 fi - if [[ "${HOST}" == "mysql" ]]; then + if [[ "${DB_HOST}" == "mysql" ]]; then while [[ "$(docker inspect -f "{{.State.Health.Status}}" jms_mysql)" != "healthy" ]]; do sleep 5s done