Skip to content

Commit

Permalink
fix: 数据库备份参数缺失
Browse files Browse the repository at this point in the history
  • Loading branch information
wojiushixiaobai authored and BaiJiangJie committed Oct 30, 2024
1 parent 8d7be01 commit 4a2d621
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions scripts/5_db_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion scripts/6_db_restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
Expand Down

0 comments on commit 4a2d621

Please sign in to comment.