Skip to content
Snippets Groups Projects
Commit f094dd30 authored by Andrey Postnikov's avatar Andrey Postnikov Committed by Andrey Postnikov
Browse files

DB: mariadb 10.6/10.3.22 prevent re-start at start-up #3449463

(cherry picked from commit b92207b2)
parent d0811de1
Branches
No related tags found
No related merge requests found
Pipeline #180684 passed
#####
######
FROM docker.io/mariadb:10.3.22
MAINTAINER drupalci
......
#!/bin/bash
terminate() {
echo "Caught termination signal, shutting down..."
if [ -n "${PID}" ]; then
kill -TERM "$(pgrep -P ${PID} -x mysqld)"
wait "${PID}"
fi
echo "Shutdown complete."
exit 0
}
trap terminate SIGTERM SIGINT
if [ ! -f /var/lib/mysql/ibdata1 ];
then
echo "rebuilding /var/lib/mysql/ibdata1"
......@@ -7,15 +19,16 @@ if [ ! -f /var/lib/mysql/ibdata1 ];
test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld
/usr/bin/mysqld_safe &
PID="${!}"
sleep 5s
while ! netcat -vz localhost 3306; do sleep 1; done
mysql -e "CREATE USER 'drupaltestbot'@'%' IDENTIFIED BY 'drupaltestbotpw';"
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'drupaltestbot'@'%' WITH GRANT OPTION; SELECT User FROM mysql.user; FLUSH PRIVILEGES;"
echo "Grants added"
killall mysqld
wait ${PID}
fi
/usr/bin/mysqld_safe;
echo "mysql died at $(date)";
# Start MySQL server if container restart and data is ready
if [ -z "${PID}" ]; then
/usr/bin/mysqld_safe &
PID="${!}"
fi
wait ${PID}
echo "mysql exited at $(date)";
####
#####
FROM docker.io/mariadb:10.6
MAINTAINER drupalci
......
#!/bin/bash
terminate() {
echo "Caught termination signal, shutting down..."
if [ -n "${PID}" ]; then
kill -TERM "$(pgrep -P ${PID} -x mariadbd)"
wait "${PID}"
fi
echo "Shutdown complete."
exit 0
}
trap terminate SIGTERM SIGINT
if [ ! -f /var/lib/mysql/ibdata1 ];
then
echo "rebuilding /var/lib/mysql/ibdata1"
......@@ -7,15 +19,16 @@ if [ ! -f /var/lib/mysql/ibdata1 ];
test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld
/usr/bin/mysqld_safe &
PID="${!}"
sleep 5s
while ! netcat -vz localhost 3306; do sleep 1; done
mysql -e "CREATE USER 'drupaltestbot'@'%' IDENTIFIED BY 'drupaltestbotpw';"
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'drupaltestbot'@'%' WITH GRANT OPTION; SELECT User FROM mysql.user; FLUSH PRIVILEGES;"
echo "Grants added"
killall mysqld
wait ${PID}
fi
/usr/bin/mysqld_safe;
echo "mysql died at $(date)";
# Start MySQL server if container restart and data is ready
if [ -z "${PID}" ]; then
/usr/bin/mysqld_safe &
PID="${!}"
fi
wait ${PID}
echo "mysql exited at $(date)";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment