mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-06 21:18:47 +00:00
updated db_create.sh [no ci]
This commit is contained in:
parent
ac8218b634
commit
8493a47495
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
DB_DEFAULT_PWD="hirs_db"
|
||||||
|
|
||||||
# Check if we're in a Docker container
|
# Check if we're in a Docker container
|
||||||
if [ -f /.dockerenv ]; then
|
if [ -f /.dockerenv ]; then
|
||||||
@ -10,25 +11,24 @@ fi
|
|||||||
echo "Creating HIRS Database..."
|
echo "Creating HIRS Database..."
|
||||||
|
|
||||||
if [ $DOCKER_CONTAINER = true ]; then
|
if [ $DOCKER_CONTAINER = true ]; then
|
||||||
echo "running in a container..."
|
|
||||||
# If in Docker container, avoid services that invoke the D-Bus
|
# If in Docker container, avoid services that invoke the D-Bus
|
||||||
# if [[ $(pgrep -c -u mysql mysqld) -eq 0 ]]; then
|
if [[ $(pgrep -c -u mysql mysqld) -eq 0 ]]; then
|
||||||
# /usr/libexec/mariadb-prepare-db-dir
|
echo "running in a container..."
|
||||||
# nohup /usr/bin/mysqld_safe --basedir=/usr &>/dev/null &
|
/usr/libexec/mysql-prepare-db-dir > /dev/null 2>&1
|
||||||
# MYSQLD_PID=$(pgrep -u mysql mysqld)
|
nohup /usr/bin/mysqld_safe > /dev/null 2>&1 &
|
||||||
# /usr/libexec/mariadb-wait-:ready $MYSQLD_PID
|
fi
|
||||||
# fi
|
|
||||||
else
|
else
|
||||||
SQL_SERVICE=`/opt/hirs/scripts/common/get_db_service.sh`
|
SQL_SERVICE=`/opt/hirs/scripts/common/get_db_service.sh`
|
||||||
systemctl $SQL_SERVICE enable
|
systemctl $SQL_SERVICE enable
|
||||||
systemctl $SQL_SERVICE start
|
systemctl $SQL_SERVICE start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mysqladmin -u root password $DB_DEFAULT_PWD
|
||||||
DB_CREATE_SCRIPT=/opt/hirs/scripts/common/db_create.sql.el7
|
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
|
// Set logfile for
|
||||||
echo '[mysqld]' >> /etc/my.cnf
|
#echo '[mysqld]' >> /etc/my.cnf
|
||||||
echo 'log-error=/var/log/mariadb/hirs_db.log' >> /etc/my.cnf
|
#echo 'log-error=/var/log/mariadb/hirs_db.log' >> /etc/my.cnf
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user