--- mysqld 2009-03-13 15:32:45.000000000 -0400 +++ mysqld.stokes 2009-03-13 15:36:56.000000000 -0400 @@ -41,8 +41,15 @@ stat_fail exit 1 else + timeo=30 + while [ $timeo -gt 0 ]; do + response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break + echo "$response" | grep -q "mysqld is alive" && break + sleep 1 + let timeo=${timeo}-1 + done sleep 1 # wait on children - if [ -z "$(getPID)" ]; then + if [ $timeo -eq 0 ]; then stat_fail exit 1 else @@ -60,7 +67,7 @@ stop) stat_busy "Stopping MySQL" if [ ! -z "$(getPID)" ]; then - kill $(getPID) &> /dev/null + kill $(getPID) &> /dev/null if [ $? -gt 0 ]; then stat_fail exit 1 @@ -81,6 +88,6 @@ $0 start ;; *) - echo "usage: $0 {start|stop|restart}" + echo "usage: $0 {start|stop|restart}" esac exit 0