Skip to content

Commit

Permalink
Merge pull request #466 from jumpserver/pr@dev@fix_db_check
Browse files Browse the repository at this point in the history
fix: 修正数据库检测
  • Loading branch information
wojiushixiaobai authored Jul 16, 2024
2 parents 7003556 + 5e4a0d0 commit e034874
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ function disable_config() {
fi
}

function check_volume_dir() {
volume_dir=$(get_config VOLUME_DIR)
if [[ -d "${volume_dir}" ]]; then
echo "1"
else
echo "0"
fi
}

function check_db_data() {
db_type=$1
if [[ ! -f "${CONFIG_FILE}" ]]; then
Expand All @@ -124,7 +133,11 @@ function get_db_info() {
info_type=$1
db_engine=$(get_config DB_ENGINE "mysql")
db_host=$(get_config DB_HOST)

check_volume_dir=$(check_volume_dir)
if [[ "${check_volume_dir}" == "0" ]]; then
db_engine=$(get_config DB_ENGINE "postgresql")
fi

mysql_data_exists="0"
mariadb_data_exists="0"
postgres_data_exists="0"
Expand Down

0 comments on commit e034874

Please sign in to comment.