mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-21 05:53:27 +00:00
update mysql check [no ci]
This commit is contained in:
parent
e0620c925d
commit
11044f92a5
@ -28,22 +28,6 @@ if [[ $(pgrep -c -u mysql mysqld) -eq 0 ]]; then
|
||||
if [ $DOCKER_CONTAINER = true ]; then
|
||||
# if in Docker container, avoid services that invoke the D-Bus
|
||||
echo "ACA is running in a container..."
|
||||
# Check is Dbus is running
|
||||
if [[ $(pgrep -c -u dbus dbus) -eq 0 ]]; then
|
||||
# Start DBus
|
||||
mkdir -p /var/run/dbus
|
||||
if [ -e /var/run/dbus/pid ]; then
|
||||
rm /var/run/dbus/pid
|
||||
fi
|
||||
if [ -e /var/run/dbus/system_bus_socket ]; then
|
||||
rm /var/run/dbus/system_bus_socket
|
||||
fi
|
||||
if [ -e /run/dbus/messagebus.pid ]; then
|
||||
rm /run/dbus/messagebus.pid
|
||||
fi
|
||||
echo "Starting dbus";
|
||||
dbus-daemon --fork --system
|
||||
fi
|
||||
# Check if mariadb is setup
|
||||
if [ ! -d "/var/lib/mysql/mysql/" ]; then
|
||||
echo "Installing mariadb"
|
||||
@ -61,20 +45,12 @@ if [[ $(pgrep -c -u mysql mysqld) -eq 0 ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Wait for mysql to start before continuing. Exit if it doesnt start.
|
||||
count=0;
|
||||
while ([ $(pgrep -c -u mysql mysqld) = "0" ] && [ "$count" -lt 100 ]); do
|
||||
# Wait for mysql to start before continuing.
|
||||
echo "Checking mysqld status..."
|
||||
while ! mysqladmin ping -h "$localhost" --silent; do
|
||||
sleep 1;
|
||||
count=$((count+1));
|
||||
done
|
||||
|
||||
if [ "$count" -gt 99 ]; then
|
||||
echo "Mysql failed to start"
|
||||
exit 1;
|
||||
else
|
||||
echo "Mysql is runnning"
|
||||
fi
|
||||
|
||||
# Set intial password, ingore result in case its already been set
|
||||
echo "Setting Mysql password"
|
||||
mysqladmin -u root --silent password $DB_DEFAULT_PWD || true > /dev/null 2>&1
|
||||
|
Loading…
Reference in New Issue
Block a user