Mageia Bugzilla – Attachment 8915 Details for
Bug 20143
mysqld is not Active after start
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Patch mysqld-wait-ready to wait 30 seconds maximum for socket and pidfile to avoid problems with mysqld_safe exiting before mysqld drop the socket and pidfile
mysqld-wait-ready.patch (text/plain), 1.62 KB, created by
Raphael Gertz
on 2017-01-31 16:44:58 CET
(
hide
)
Description:
Patch mysqld-wait-ready to wait 30 seconds maximum for socket and pidfile to avoid problems with mysqld_safe exiting before mysqld drop the socket and pidfile
Filename:
MIME Type:
Creator:
Raphael Gertz
Created:
2017-01-31 16:44:58 CET
Size:
1.62 KB
patch
obsolete
>diff -urNp /usr/sbin/mysqld-wait-ready.orig /usr/sbin/mysqld-wait-ready >--- /usr/sbin/mysqld-wait-ready.orig 2017-01-29 20:19:14.000000000 +0100 >+++ /usr/sbin/mysqld-wait-ready 2017-01-31 16:42:40.330396856 +0100 >@@ -6,9 +6,6 @@ > # 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 >-daemon_pid="$1" >- > # extract value of a MySQL option from config files > # Usage: get_mysql_option SECTION VARNAME DEFAULT > # result is returned in $result >@@ -27,6 +24,26 @@ get_mysql_option mysqld datadir "/var/li > datadir="$result" > get_mysql_option mysqld socket "$datadir/mysql.sock" > socketfile="$result" >+get_mysql_option mysqld pid-file "/var/run/mysqld/mysqld.pid" >+pidfile="$result" >+ >+# Service file passes us the daemon's PID >+daemon_pid="$1" >+ >+# Wait for socketfile and pidfile for 30 seconds >+timeout=30 >+if [ -z "$daemon_pid" -o ! -S "$socketfile" -o ! -s "$pidfile" ]; then >+ while [ $timeout -gt 0 ]; do >+ sleep 1; >+ timeout=$(($timeout - 1)); >+ if [ -z "$daemon_pid" -a -s $pidfile ]; then >+ daemon_pid=`cat $pidfile`; >+ fi >+ if [ ! -z "$daemon_pid" -a -S "$socketfile" -a -s "$pidfile" ]; then >+ break; >+ fi >+ done >+fi > > # Wait for the server to come up or for the mysqld process to disappear > ret=0 >@@ -43,7 +60,7 @@ while /bin/true; do > break > fi > # "Access denied" also means the server is alive >- echo "$RESPONSE" | grep -q "Access denied for user" && break >+ echo "$RESPONSE" | \grep -q "Access denied for user" && break > > # Check process still exists > if ! /bin/kill -0 $daemon_pid 2>/dev/null; then
diff -urNp /usr/sbin/mysqld-wait-ready.orig /usr/sbin/mysqld-wait-ready --- /usr/sbin/mysqld-wait-ready.orig 2017-01-29 20:19:14.000000000 +0100 +++ /usr/sbin/mysqld-wait-ready 2017-01-31 16:42:40.330396856 +0100 @@ -6,9 +6,6 @@ # 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 -daemon_pid="$1" - # extract value of a MySQL option from config files # Usage: get_mysql_option SECTION VARNAME DEFAULT # result is returned in $result @@ -27,6 +24,26 @@ get_mysql_option mysqld datadir "/var/li datadir="$result" get_mysql_option mysqld socket "$datadir/mysql.sock" socketfile="$result" +get_mysql_option mysqld pid-file "/var/run/mysqld/mysqld.pid" +pidfile="$result" + +# Service file passes us the daemon's PID +daemon_pid="$1" + +# Wait for socketfile and pidfile for 30 seconds +timeout=30 +if [ -z "$daemon_pid" -o ! -S "$socketfile" -o ! -s "$pidfile" ]; then + while [ $timeout -gt 0 ]; do + sleep 1; + timeout=$(($timeout - 1)); + if [ -z "$daemon_pid" -a -s $pidfile ]; then + daemon_pid=`cat $pidfile`; + fi + if [ ! -z "$daemon_pid" -a -S "$socketfile" -a -s "$pidfile" ]; then + break; + fi + done +fi # Wait for the server to come up or for the mysqld process to disappear ret=0 @@ -43,7 +60,7 @@ while /bin/true; do break fi # "Access denied" also means the server is alive - echo "$RESPONSE" | grep -q "Access denied for user" && break + echo "$RESPONSE" | \grep -q "Access denied for user" && break # Check process still exists if ! /bin/kill -0 $daemon_pid 2>/dev/null; then
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 20143
: 8915 |
8925
|
8936
|
8937
|
8938
|
8944
|
8952
|
8953
|
8954
|
8955