
export prefix=__PREFIX__
export instance_dir=__INSTANCE_DIR__

export pid_file=$instance_dir/mysqld.pid
export lock_file=$instance_dir/mysqld.lock

cd $prefix
if [ ! -e $pid_file ]; then echo "no pid file for mysql"; exit; fi

mysqld_pid=`cat $pid_file`
echo "Killing mysqld with pid $mysqld_pid"
kill $mysqld_pid
  # mysqld should remove the pid_file when it exits, so wait for it.

sleep 1
while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
  do
    flags=a$flags
    sleep 1
  done
if [ -s $pid_file ]
  then echo " gave up waiting!"
elif [ -n "$flags" ]
  then echo " done"
fi

  # delete lock for RedHat / SuSE
if test -f $lock_file
then
  rm -f $lock_file
fi
