Allow init script's STARTTIMEOUT/STOPTIMEOUT to be overridden from

sysconfig
This commit is contained in:
Tom Lane 2010-07-14 02:08:48 +00:00 committed by Michal Schorm
parent 19be51b028
commit e17e7b214b
2 changed files with 19 additions and 10 deletions

View File

@ -19,6 +19,10 @@
exec="/usr/bin/mysqld_safe" exec="/usr/bin/mysqld_safe"
prog="mysqld" 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 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/$prog lockfile=/var/lock/subsys/$prog
@ -101,8 +105,8 @@ start(){
# Rather than assuming we know a valid username, accept an "access # Rather than assuming we know a valid username, accept an "access
# denied" response as meaning the server is functioning. # denied" response as meaning the server is functioning.
ret=0 ret=0
STARTTIMEOUT=120 TIMEOUT="$STARTTIMEOUT"
while [ $STARTTIMEOUT -gt 0 ]; do while [ $TIMEOUT -gt 0 ]; do
RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1` && break RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1` && break
echo "$RESPONSE" | grep -q "Access denied for user" && break echo "$RESPONSE" | grep -q "Access denied for user" && break
if ! /bin/kill -0 $safe_pid 2>/dev/null; then if ! /bin/kill -0 $safe_pid 2>/dev/null; then
@ -111,9 +115,9 @@ start(){
break break
fi fi
sleep 1 sleep 1
let STARTTIMEOUT=${STARTTIMEOUT}-1 let TIMEOUT=${TIMEOUT}-1
done done
if [ $STARTTIMEOUT -eq 0 ]; then if [ $TIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to start MySQL Daemon." echo "Timeout error occurred trying to start MySQL Daemon."
ret=1 ret=1
fi fi
@ -138,13 +142,13 @@ stop(){
/bin/kill "$MYSQLPID" >/dev/null 2>&1 /bin/kill "$MYSQLPID" >/dev/null 2>&1
ret=$? ret=$?
if [ $ret -eq 0 ]; then if [ $ret -eq 0 ]; then
STOPTIMEOUT=60 TIMEOUT="$STOPTIMEOUT"
while [ $STOPTIMEOUT -gt 0 ]; do while [ $TIMEOUT -gt 0 ]; do
/bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break /bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break
sleep 1 sleep 1
let STOPTIMEOUT=${STOPTIMEOUT}-1 let TIMEOUT=${TIMEOUT}-1
done done
if [ $STOPTIMEOUT -eq 0 ]; then if [ $TIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to stop MySQL Daemon." echo "Timeout error occurred trying to stop MySQL Daemon."
ret=1 ret=1
action $"Stopping $prog: " /bin/false action $"Stopping $prog: " /bin/false

View File

@ -1,6 +1,6 @@
Name: mysql Name: mysql
Version: 5.1.48 Version: 5.1.48
Release: 1%{?dist} Release: 2%{?dist}
Summary: MySQL client programs and shared libraries Summary: MySQL client programs and shared libraries
Group: Applications/Databases Group: Applications/Databases
URL: http://www.mysql.com 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 mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf 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 cp %{SOURCE6} README.mysql-docs
%clean %clean
@ -574,13 +574,18 @@ fi
%{_mandir}/man1/mysql_client_test.1* %{_mandir}/man1/mysql_client_test.1*
%changelog %changelog
* Tue Jul 13 2010 Tom Lane <tgl@redhat.com> 5.1.48-2
- Duplicate COPYING and EXCEPTIONS-CLIENT in -libs and -embedded subpackages, - Duplicate COPYING and EXCEPTIONS-CLIENT in -libs and -embedded subpackages,
to ensure they are available when any subset of mysql RPMs are installed, to ensure they are available when any subset of mysql RPMs are installed,
per revised packaging guidelines per revised packaging guidelines
- Allow init script's STARTTIMEOUT/STOPTIMEOUT to be overridden from sysconfig
Related: #609734
* Mon Jun 21 2010 Tom Lane <tgl@redhat.com> 5.1.48-1 * Mon Jun 21 2010 Tom Lane <tgl@redhat.com> 5.1.48-1
- Update to MySQL 5.1.48, for various fixes described at - 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 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 <tgl@redhat.com> 5.1.47-2 * Fri Jun 4 2010 Tom Lane <tgl@redhat.com> 5.1.47-2
- Add back "partition" storage engine - Add back "partition" storage engine