summaryrefslogtreecommitdiff
path: root/mysql-test/ndb/ndbcluster.sh
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.(none)>2004-09-02 15:02:46 +0000
committerunknown <tomas@poseidon.(none)>2004-09-02 15:02:46 +0000
commit467017139e7ed040bdf4c2650ac037a9a558dc63 (patch)
tree0256e4784aae115630d14e846b6cac59b2ca8dc8 /mysql-test/ndb/ndbcluster.sh
parent8628937ec276823b597287a65eb908a99e21443b (diff)
downloadmariadb-git-467017139e7ed040bdf4c2650ac037a9a558dc63.tar.gz
see resp file
mysql-test/ndb/ndbcluster.sh: added better/safer shutdown
Diffstat (limited to 'mysql-test/ndb/ndbcluster.sh')
-rw-r--r--mysql-test/ndb/ndbcluster.sh36
1 files changed, 25 insertions, 11 deletions
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index e04e22f1434..c84d9e36979 100644
--- a/mysql-test/ndb/ndbcluster.sh
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -57,6 +57,10 @@ while test $# -gt 0; do
flags_ndb="$flags_ndb -i"
initial_ndb=1
;;
+ --debug*)
+ f=`echo "$1" | sed -e "s;--debug=;;"`
+ flags_ndb="$flags_ndb $f"
+ ;;
--status)
status_ndb=1
;;
@@ -180,15 +184,6 @@ status_ndbcluster() {
stop_default_ndbcluster() {
-#if [ ! -f $pidfile ] ; then
-# exit 0
-#fi
-
-#if [ ! -f $cfgfile ] ; then
-# echo "$cfgfile missing"
-# exit 1
-#fi
-
# Start management client
exec_mgmtclient="$exec_mgmtclient --try-reconnect=1"
@@ -196,10 +191,29 @@ exec_mgmtclient="$exec_mgmtclient --try-reconnect=1"
echo "shutdown" | $exec_mgmtclient 2>&1 | cat > /dev/null
if [ -f "$fs_ndb/$pidfile" ] ; then
- kill -9 `cat "$fs_ndb/$pidfile"` 2> /dev/null
+ kill_pids=`cat "$fs_ndb/$pidfile"`
+ attempt=0
+ while [ $attempt -lt 10 ] ; do
+ new_kill_pid=""
+ for p in $kill_pids ; do
+ kill -0 $p 2> /dev/null
+ if [ $? -eq 0 ] ; then
+ new_kill_pid="$p $new_kill_pid"
+ fi
+ done
+ kill_pids=$new_kill_pid
+ if [ "$kill_pids" == "" ] ; then
+ break
+ fi
+ sleep 1
+ attempt=`expr $attempt + 1`
+ done
+ if [ "$kill_pids" != "" ] ; then
+ echo "Failed to shutdown ndbcluster, executing kill -9 "$kill_pids
+ kill -9 $kill_pids
+ fi
rm "$fs_ndb/$pidfile"
fi
-
}
if [ $status_ndb ] ; then