Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 数据库备份参数缺失 #489

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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