mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-03 03:36:49 +00:00
updated db_create.sh [no ci]
This commit is contained in:
parent
ac8218b634
commit
8493a47495
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user