mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2025-12-22 09:27:32 -08:00
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
57 lines
1.7 KiB
Bash
57 lines
1.7 KiB
Bash
#!/bin/sh
|
|
|
|
# This script waits for mysqld to be ready to accept connections
|
|
# (which can be many seconds or even minutes after launch, if there's
|
|
# a lot of crash-recovery work to do).
|
|
# Running this as ExecStartPost is useful so that services declared as
|
|
# "After mysqld" won't be started until the database is really ready.
|
|
|
|
# Service file passes us the daemon's PID (actually, mysqld_safe's PID)
|
|
daemon_pid="$1"
|
|
|
|
# extract value of a MySQL option from config files
|
|
# Usage: get_mysql_option SECTION VARNAME DEFAULT
|
|
# result is returned in $result
|
|
# We use my_print_defaults which prints all options from multiple files,
|
|
# with the more specific ones later; hence take the last match.
|
|
get_mysql_option(){
|
|
result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1`
|
|
if [ -z "$result" ]; then
|
|
# not found, use default
|
|
result="$3"
|
|
fi
|
|
}
|
|
|
|
# Defaults here had better match what mysqld_safe will default to
|
|
get_mysql_option mysqld datadir "/var/lib/mysql"
|
|
datadir="$result"
|
|
get_mysql_option mysqld socket "/var/lib/mysql/mysql.sock"
|
|
socketfile="$result"
|
|
|
|
# Wait for the server to come up or for the mysqld process to disappear
|
|
ret=0
|
|
while /bin/true; do
|
|
RESPONSE=`/usr/bin/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
|
|
mret=$?
|
|
if [ $mret -eq 0 ]; then
|
|
break
|
|
fi
|
|
# exit codes 1, 11 (EXIT_CANNOT_CONNECT_TO_SERVICE) are expected,
|
|
# anything else suggests a configuration error
|
|
if [ $mret -ne 1 -a $mret -ne 11 ]; then
|
|
ret=1
|
|
break
|
|
fi
|
|
# "Access denied" also means the server is alive
|
|
echo "$RESPONSE" | grep -q "Access denied for user" && break
|
|
|
|
# Check process still exists
|
|
if ! /bin/kill -0 $daemon_pid 2>/dev/null; then
|
|
ret=1
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
exit $ret
|