diff -r a6ace259e187 heartbeat/mysql
--- a/heartbeat/mysql	Mon Nov 30 10:05:00 2009 +0900
+++ b/heartbeat/mysql	Wed Dec 02 10:19:39 2009 +0900
@@ -35,7 +35,6 @@
 #   OCF_RESKEY_log
 #   OCF_RESKEY_pid
 #   OCF_RESKEY_socket
-
 #######################################################################
 # Initialization:
 
@@ -408,16 +407,26 @@
 	return $OCF_ERR_GENERIC
     fi
 
-    stop_wait=1
-    while [ $stop_wait = 1 ]; do
+	# stop waiting
+	shutdown_timeout=$((($OCF_RESKEY_CRM_meta_timeout/1000)-5))
+	count=0
+	while [ $count -lt $shutdown_timeout ]
+	do
+		mysql_status
+		rc=$?
+		if [ $rc = $OCF_NOT_RUNNING ]; then
+			break
+		fi
+		count=`expr $count + 1`
+		sleep 1
+		ocf_log debug "MySQL still hasn't stopped yet. Waiting..."
+	done
+
 	mysql_status
-	rc=$?
-	if [ $rc = $OCF_NOT_RUNNING ]; then
-	    stop_wait=0
+	if [ $? != $OCF_NOT_RUNNING ]; then
+		ocf_log info "MySQL failed to stop after ${OCF_RESKEY_stop_escalate}s using SIGTERM. Trying SIGKILL..."
+		/bin/kill -KILL $pid > /dev/null
 	fi
-        sleep 1
-	ocf_log debug "MySQL still hasn't stopped yet. Waiting..."
-    done
 
     ocf_log info "MySQL stopped";
     rm -f /var/lock/subsys/mysqld
