Make stop script wait for daemon process to disappear (bz#172426)

This commit is contained in:
Tom Lane 2005-11-14 17:31:18 +00:00 committed by Michal Schorm
parent e8b83fa128
commit 96aca199d7
2 changed files with 33 additions and 13 deletions

View File

@ -76,7 +76,7 @@ start(){
# 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=10
STARTTIMEOUT=30
while [ $STARTTIMEOUT -gt 0 ]; do
RESPONSE=`/usr/bin/mysqladmin -uUNKNOWN_MYSQL_USER ping 2>&1` && break
echo "$RESPONSE" | grep -q "Access denied for user" && break
@ -97,17 +97,34 @@ start(){
}
stop(){
/bin/kill `cat "$mypidfile" 2>/dev/null ` >/dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
sleep 2
rm -f /var/lock/subsys/mysqld
rm -f "$socketfile"
action $"Stopping $prog: " /bin/true
else
action $"Stopping $prog: " /bin/false
fi
return $ret
MYSQLPID=`cat "$mypidfile" 2>/dev/null `
if [ -n "$MYSQLPID" ]; then
/bin/kill "$MYSQLPID" >/dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
STOPTIMEOUT=60
while [ $STOPTIMEOUT -gt 0 ]; do
/bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break
sleep 1
let STOPTIMEOUT=${STOPTIMEOUT}-1
done
if [ $STOPTIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to stop MySQL Daemon."
ret=1
action $"Stopping $prog: " /bin/false
else
rm -f /var/lock/subsys/mysqld
rm -f "$socketfile"
action $"Stopping $prog: " /bin/true
fi
else
action $"Stopping $prog: " /bin/false
fi
else
ret=1
action $"Stopping $prog: " /bin/false
fi
return $ret
}
restart(){

View File

@ -1,6 +1,6 @@
Name: mysql
Version: 5.0.15
Release: 2
Release: 3
Source0: http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-%{version}.tar.gz
Source1: mysql.init
Source2: mysql.logrotate
@ -355,6 +355,9 @@ fi
%{_datadir}/sql-bench
%changelog
* Mon Nov 14 2005 Tom Lane <tgl@redhat.com> 5.0.15-3
- Make stop script wait for daemon process to disappear (bz#172426)
* Wed Nov 9 2005 Tom Lane <tgl@redhat.com> 5.0.15-2
- Rebuild due to openssl library update.