From 8493a47495a19a755a1c6bb482a35b18cf987f28 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 13 Jan 2023 22:30:29 +0000 Subject: [PATCH] updated db_create.sh [no ci] --- package/scripts/common/db_create.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package/scripts/common/db_create.sh b/package/scripts/common/db_create.sh index 4d0b0a9c..43d2447b 100644 --- a/package/scripts/common/db_create.sh +++ b/package/scripts/common/db_create.sh @@ -1,4 +1,5 @@ #!/bin/bash +DB_DEFAULT_PWD="hirs_db" # Check if we're in a Docker container if [ -f /.dockerenv ]; then @@ -10,25 +11,24 @@ fi echo "Creating HIRS Database..." if [ $DOCKER_CONTAINER = true ]; then - echo "running in a container..." - # If in Docker container, avoid services that invoke the D-Bus - # if [[ $(pgrep -c -u mysql mysqld) -eq 0 ]]; then - # /usr/libexec/mariadb-prepare-db-dir - # nohup /usr/bin/mysqld_safe --basedir=/usr &>/dev/null & - # MYSQLD_PID=$(pgrep -u mysql mysqld) - # /usr/libexec/mariadb-wait-:ready $MYSQLD_PID - # fi + # If in Docker container, avoid services that invoke the D-Bus + if [[ $(pgrep -c -u mysql mysqld) -eq 0 ]]; then + echo "running in a container..." + /usr/libexec/mysql-prepare-db-dir > /dev/null 2>&1 + nohup /usr/bin/mysqld_safe > /dev/null 2>&1 & + fi else SQL_SERVICE=`/opt/hirs/scripts/common/get_db_service.sh` systemctl $SQL_SERVICE enable systemctl $SQL_SERVICE start fi +mysqladmin -u root password $DB_DEFAULT_PWD DB_CREATE_SCRIPT=/opt/hirs/scripts/common/db_create.sql.el7 -mysql -u root --password="hirs_db" < $DB_CREATE_SCRIPT +mysql -u root --password="$DB_DEFAULT_PWD" < $DB_CREATE_SCRIPT // Set logfile for -echo '[mysqld]' >> /etc/my.cnf -echo 'log-error=/var/log/mariadb/hirs_db.log' >> /etc/my.cnf +#echo '[mysqld]' >> /etc/my.cnf +#echo 'log-error=/var/log/mariadb/hirs_db.log' >> /etc/my.cnf