From e17e7b214b0efa7773d7a61030c3a6a10a8858ce Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 14 Jul 2010 02:08:48 +0000 Subject: [PATCH] Allow init script's STARTTIMEOUT/STOPTIMEOUT to be overridden from sysconfig --- mysql.init | 20 ++++++++++++-------- mysql.spec | 9 +++++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/mysql.init b/mysql.init index 31f4301..1661f3b 100644 --- a/mysql.init +++ b/mysql.init @@ -19,6 +19,10 @@ exec="/usr/bin/mysqld_safe" prog="mysqld" +# Set timeouts here so they can be overridden from /etc/sysconfig/mysqld +STARTTIMEOUT=120 +STOPTIMEOUT=60 + [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog lockfile=/var/lock/subsys/$prog @@ -101,8 +105,8 @@ start(){ # Rather than assuming we know a valid username, accept an "access # denied" response as meaning the server is functioning. ret=0 - STARTTIMEOUT=120 - while [ $STARTTIMEOUT -gt 0 ]; do + TIMEOUT="$STARTTIMEOUT" + while [ $TIMEOUT -gt 0 ]; do RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1` && break echo "$RESPONSE" | grep -q "Access denied for user" && break if ! /bin/kill -0 $safe_pid 2>/dev/null; then @@ -111,9 +115,9 @@ start(){ break fi sleep 1 - let STARTTIMEOUT=${STARTTIMEOUT}-1 + let TIMEOUT=${TIMEOUT}-1 done - if [ $STARTTIMEOUT -eq 0 ]; then + if [ $TIMEOUT -eq 0 ]; then echo "Timeout error occurred trying to start MySQL Daemon." ret=1 fi @@ -138,13 +142,13 @@ stop(){ /bin/kill "$MYSQLPID" >/dev/null 2>&1 ret=$? if [ $ret -eq 0 ]; then - STOPTIMEOUT=60 - while [ $STOPTIMEOUT -gt 0 ]; do + TIMEOUT="$STOPTIMEOUT" + while [ $TIMEOUT -gt 0 ]; do /bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break sleep 1 - let STOPTIMEOUT=${STOPTIMEOUT}-1 + let TIMEOUT=${TIMEOUT}-1 done - if [ $STOPTIMEOUT -eq 0 ]; then + if [ $TIMEOUT -eq 0 ]; then echo "Timeout error occurred trying to stop MySQL Daemon." ret=1 action $"Stopping $prog: " /bin/false diff --git a/mysql.spec b/mysql.spec index cbb7b07..4e1ad71 100644 --- a/mysql.spec +++ b/mysql.spec @@ -1,6 +1,6 @@ Name: mysql Version: 5.1.48 -Release: 1%{?dist} +Release: 2%{?dist} Summary: MySQL client programs and shared libraries Group: Applications/Databases URL: http://www.mysql.com @@ -354,7 +354,7 @@ rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-test-run.pl.1* mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf -# copy additional docs into build tree so %doc will find them +# copy additional docs into build tree so %%doc will find them cp %{SOURCE6} README.mysql-docs %clean @@ -574,13 +574,18 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Tue Jul 13 2010 Tom Lane 5.1.48-2 - Duplicate COPYING and EXCEPTIONS-CLIENT in -libs and -embedded subpackages, to ensure they are available when any subset of mysql RPMs are installed, per revised packaging guidelines +- Allow init script's STARTTIMEOUT/STOPTIMEOUT to be overridden from sysconfig +Related: #609734 * Mon Jun 21 2010 Tom Lane 5.1.48-1 - Update to MySQL 5.1.48, for various fixes described at http://dev.mysql.com/doc/refman/5.1/en/news-5-1-48.html + including a fix for CVE-2010-2008 +Related: #614214 * Fri Jun 4 2010 Tom Lane 5.1.47-2 - Add back "partition" storage engine