stop_ndbcluster 1013 Bytes
Newer Older
unknown's avatar
unknown committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/bin/sh
# Copyright (C) 2004 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file

# This scripts stops the table handler ndbcluster

bindir=`pwd`/../ndb/bin
pidfile=ndbcluster.pid
cfgfile=Ndb.cfg

while test $# -gt 0; do
  case "$1" in
    --port-base=*)
     port_base=`echo "$1" | sed -e "s;--port-base=;;"`
     ;;
    -- )  shift; break ;;
    --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
    * ) break ;;
  esac
  shift
done

stop_default_ndbcluster() {

unknown's avatar
unknown committed
25 26 27
#if [ ! -f $pidfile ] ; then
#  exit 0
#fi
unknown's avatar
unknown committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

if [ ! -f $cfgfile ] ; then
  echo "$cfgfile missing"
  exit 1
fi

ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
ndb_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`

# Start management client

exec_mgmtclient="$bindir/mgmtclient --try-reconnect=1 $ndb_host $ndb_port"

echo "$exec_mgmtclient"
echo "all stop" | $exec_mgmtclient

sleep 5

unknown's avatar
unknown committed
46 47 48 49 50
if [ -f $pidfile ] ; then
  kill `cat $pidfile`
  rm $pidfile
fi

unknown's avatar
unknown committed
51 52 53 54 55
}

stop_default_ndbcluster

exit 0