Branch: Tag:

2003-12-03

2003-12-03 10:45:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Give MySQL up to 5 minutes to shutdown.

Rev: server/start:1.208

1:   #!/bin/sh   # - # $Id: start,v 1.207 2003/10/13 14:20:42 grubba Exp $ + # $Id: start,v 1.208 2003/12/03 10:45:42 grubba Exp $      ### If --silent-start is given as the first argument,   ### nothing will be printed to stdout by the script.
661:    fi    if [ "x$keep_mysql" = "x" ] ; then    if [ -f $DIR/_mysql/mysql_pid ] ; then -  dp "Shutting down MySQL." -  kill `cat $DIR/_mysql/mysql_pid` 2>/dev/null +  dp_no_nl "Shutting down MySQL." +  mysql_pid=`cat $DIR/_mysql/mysql_pid` +  kill "$mysql_pid" 2>/dev/null +  # Give mysql 5 minutes to shut down. +  timer="" +  while [ -f "$DIR/_mysql/mysql_pid" -a \ +  "$timer" != "mmmmm" ] && \ +  kill -0 "$mysql_pid"; do    sleep 2 -  if [ -f $DIR/_mysql/mysql_pid ] ; then -  kill -9 `cat $DIR/_mysql/mysql_pid` 2>/dev/null +  timer=`echo "x$timer" | sed -e 's/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/m/'` +  if [ "x$SILENT_START" != "xy" ]; then +  # Progress indicator. +  echo "." | tr -d ' + ' >&2    fi -  rm -f $DIR/_mysql/mysql_pid 2>/dev/null +  done +  if [ "x$SILENT_START" != "xy" ]; then +  echo >&2    fi -  +  if [ kill -0 "$mysql_pid" ] ; then +  dp "Shutting down MySQL the hard way." +  kill -9 "$mysql_pid" 2>/dev/null    fi -  +  if [ -f "$DIR/_mysql/mysql_pid" && \ +  "$mysql_pid" = "`cat $DIR/_mysql/mysql_pid`" ]; then +  rm -f "$DIR/_mysql/mysql_pid" 2>/dev/null +  fi +  fi +  fi    dp "Start script terminated."    exit 0   }