/usr/share/mysql/mysql-systemd-start is in mysql-server-5.7 5.7.11-0ubuntu6.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #!/bin/bash
#
# Scripts to run by MySQL systemd service
#
# Needed argument: pre | post
#
# pre mode : try to perform sanity check for configuration, log, data
# post mode : ping server until answer is received
sanity () {
if [ ! -r /etc/mysql/my.cnf ]; then
echo "MySQL configuration not found at /etc/mysql/my.cnf. Please create one."
exit 1
fi
if [ ! -d /var/lib/mysql ] && [ ! -L /var/lib/mysql ]; then
echo "MySQL data dir not found at /var/lib/mysql. Please create one."
exit 1
fi
if [ ! -d /var/lib/mysql/mysql ] && [ ! -L /var/lib/mysql/mysql ]; then
echo "MySQL system database not found. Please run mysql_install_db tool."
exit 1
fi
}
pinger () {
server_up=false
for i in $(seq 1 30); do
sleep 1
if mysqladmin ping >/dev/null 2>&1; then
server_up=true
break
fi
done
if [ ! $server_up ]; then
echo "MySQL server not started"
exit 1
fi
}
case $1 in
"pre") sanity ;;
"post") pinger ;;
esac
|