Stop waiting during "service mysqld start" if mysqld_safe exits
This commit is contained in:
parent
c3774f4303
commit
0354074618
45
mysql.init
45
mysql.init
@ -72,29 +72,34 @@ start(){
|
||||
/usr/bin/mysqld_safe --datadir="$datadir" --socket="$socketfile" \
|
||||
--pid-file="$mypidfile" \
|
||||
--user=mysql >/dev/null 2>&1 &
|
||||
ret=$?
|
||||
# Spin for a maximum of N seconds waiting for the server to come up.
|
||||
safe_pid=$!
|
||||
# Spin for a maximum of N seconds waiting for the server to come up;
|
||||
# exit the loop immediately if mysqld_safe process disappears.
|
||||
# Rather than assuming we know a valid username, accept an "access
|
||||
# denied" response as meaning the server is functioning.
|
||||
if [ $ret -eq 0 ]; then
|
||||
STARTTIMEOUT=60
|
||||
while [ $STARTTIMEOUT -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
|
||||
sleep 1
|
||||
let STARTTIMEOUT=${STARTTIMEOUT}-1
|
||||
done
|
||||
if [ $STARTTIMEOUT -eq 0 ]; then
|
||||
echo "Timeout error occurred trying to start MySQL Daemon."
|
||||
action $"Starting $prog: " /bin/false
|
||||
ret=1
|
||||
else
|
||||
action $"Starting $prog: " /bin/true
|
||||
fi
|
||||
else
|
||||
action $"Starting $prog: " /bin/false
|
||||
ret=0
|
||||
STARTTIMEOUT=120
|
||||
while [ $STARTTIMEOUT -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
|
||||
echo "MySQL Daemon failed to start."
|
||||
ret=1
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
let STARTTIMEOUT=${STARTTIMEOUT}-1
|
||||
done
|
||||
if [ $STARTTIMEOUT -eq 0 ]; then
|
||||
echo "Timeout error occurred trying to start MySQL Daemon."
|
||||
ret=1
|
||||
fi
|
||||
if [ $ret -eq 0 ]; then
|
||||
action $"Starting $prog: " /bin/true
|
||||
touch /var/lock/subsys/mysqld
|
||||
else
|
||||
action $"Starting $prog: " /bin/false
|
||||
fi
|
||||
[ $ret -eq 0 ] && touch /var/lock/subsys/mysqld
|
||||
return $ret
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: mysql
|
||||
Version: 5.1.41
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: MySQL client programs and shared libraries
|
||||
Group: Applications/Databases
|
||||
URL: http://www.mysql.com
|
||||
@ -649,9 +649,15 @@ fi
|
||||
%{_mandir}/man1/mysql_client_test.1*
|
||||
|
||||
%changelog
|
||||
* Thu Dec 17 2009 Tom Lane <tgl@redhat.com> 5.1.41-2
|
||||
- Stop waiting during "service mysqld start" if mysqld_safe exits
|
||||
Resolves: #544095
|
||||
|
||||
* Mon Nov 23 2009 Tom Lane <tgl@redhat.com> 5.1.41-1
|
||||
- Update to MySQL 5.1.41, for various fixes described at
|
||||
http://dev.mysql.com/doc/refman/5.1/en/news-5-1-41.html
|
||||
including fixes for CVE-2009-4019
|
||||
Related: #540906
|
||||
- Don't set old_passwords=1; we aren't being bug-compatible with 3.23 anymore
|
||||
Resolves: #540735
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user