

### I stole some of the code from the mysql installation scripts.

#export prefix=/usr/local/mysql-4.1.5
export pid_file=data/mysql.pid
export lock_file=var/lock/subsys/mysql

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

mysqld_pid=`cat $prefix/$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 $prefix/$pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
  do
    flags=a$flags
    sleep 1
  done
if [ -s $prefix/$pid_file ]
  then echo " gave up waiting!"
elif [ -n "$flags" ]
  then echo " done"
fi

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