mysqld_safe.sh 16.1 KB
Newer Older
bk@work.mysql.com's avatar
bk@work.mysql.com committed
1 2 3 4
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
#
5
# Script to start the MySQL daemon and restart it if it dies unexpectedly
bk@work.mysql.com's avatar
bk@work.mysql.com committed
6 7
#
# This should be executed in the MySQL base directory if you are using a
8 9
# binary installation that is not installed in its compile-time default
# location
bk@work.mysql.com's avatar
bk@work.mysql.com committed
10 11
#
# mysql.server works by first doing a cd to the base directory and from there
12
# executing mysqld_safe
bk@work.mysql.com's avatar
bk@work.mysql.com committed
13

14
KILL_MYSQLD=1;
15
MYSQLD=
16
niceness=0
17 18 19 20
# Initial logging status: error log is not open, and not using syslog
logging=init
want_syslog=0
syslog_tag=
21
user='@MYSQLD_USER@'
22 23
pid_file=
err_log=
24

25 26 27
syslog_tag_mysqld=mysqld
syslog_tag_mysqld_safe=mysqld_safe

bk@work.mysql.com's avatar
bk@work.mysql.com committed
28 29
trap '' 1 2 3 15			# we shouldn't let anyone kill us

30 31
umask 007

bk@work.mysql.com's avatar
bk@work.mysql.com committed
32 33
defaults=
case "$1" in
34
    --no-defaults|--defaults-file=*|--defaults-extra-file=*)
bk@work.mysql.com's avatar
bk@work.mysql.com committed
35 36 37 38
      defaults="$1"; shift
      ;;
esac

39 40 41 42 43 44 45 46 47 48 49 50 51 52
usage () {
        cat <<EOF
Usage: $0 [OPTIONS]
  --no-defaults              Don't read the system defaults file
  --defaults-file=FILE       Use the specified defaults file
  --defaults-extra-file=FILE Also use defaults from the specified file
  --ledir=DIRECTORY          Look for mysqld in the specified directory
  --open-files-limit=LIMIT   Limit the number of open files
  --core-file-size=LIMIT     Limit core files to the specified size
  --timezone=TZ              Set the system timezone
  --mysqld=FILE              Use the specified file as mysqld
  --mysqld-version=VERSION   Use "mysqld-VERSION" as mysqld
  --nice=NICE                Set the scheduling priority of mysqld
  --skip-kill-mysqld         Don't try to kill stray mysqld processes
53
  --syslog                   Log messages to syslog with 'logger'
54 55
  --skip-syslog              Log messages to error log (default)
  --syslog-tag=TAG           Pass -t "mysqld-TAG" to 'logger'
56 57 58 59 60 61 62

All other options are passed to the mysqld program.

EOF
        exit 1
}

63 64 65 66
my_which ()
{
  save_ifs="${IFS-UNSET}"
  IFS=:
67
  ret=0
68 69
  for file
  do
70
    for dir in "$PATH"
71 72 73 74 75 76 77
    do
      if [ -f "$dir/$file" ]
      then
        echo "$dir/$file"
        continue 2
      fi
    done
78 79 80

	ret=1  #signal an error
	break
81
  done
82

83 84 85 86 87 88
  if [ "$save_ifs" = UNSET ]
  then
    unset IFS
  else
    IFS="$save_ifs"
  fi
89
  return $ret  # Success
90 91
}

92 93 94 95 96 97
log_generic () {
  priority="$1"
  shift

  msg="`date +'%y%m%d %H:%M:%S'` mysqld_safe $*"
  echo "$msg"
98 99 100 101 102 103 104 105 106
  case $logging in
    init) ;;  # Just echo the message, don't save it anywhere
    file) echo "$msg" >> "$err_log" ;;
    syslog) logger -t "$syslog_tag_mysqld_safe" -p "$priority" "$*" ;;
    *)
      echo "Internal program error (non-fatal):" \
           " unknown logging method '$logging'" >&2
      ;;
  esac
107 108 109 110 111 112 113 114 115 116 117 118
}

log_error () {
  log_generic daemon.error "$@" >&2
}

log_notice () {
  log_generic daemon.notice "$@"
}

eval_log_error () {
  cmd="$1"
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
  case $logging in
    file) cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" ;;
    syslog)
      # mysqld often prefixes its messages with a timestamp, which is
      # redundant when logging to syslog (which adds its own timestamp)
      # However, we don't strip the timestamp with sed here, because
      # sed buffers output (only GNU sed supports a -u (unbuffered) option)
      # which means that messages may not get sent to syslog until the
      # mysqld process quits.
      cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error"
      ;;
    *)
      echo "Internal program error (non-fatal):" \
           " unknown logging method '$logging'" >&2
      ;;
  esac

136 137 138 139
  #echo "Running mysqld: [$cmd]"
  eval "$cmd"
}

140 141 142 143 144
shell_quote_string() {
  # This sed command makes sure that any special chars are quoted,
  # so the arg gets passed exactly to the server.
  echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g'
}
145

bk@work.mysql.com's avatar
bk@work.mysql.com committed
146
parse_arguments() {
147 148 149 150 151 152 153 154 155 156 157
  # We only need to pass arguments through to the server if we don't
  # handle them here.  So, we collect unrecognized options (passed on
  # the command line) into the args variable.
  pick_args=
  if test "$1" = PICK-ARGS-FROM-ARGV
  then
    pick_args=1
    shift
  fi

  for arg do
158
    val=`echo "$arg" | sed -e "s;--[^=]*=;;"`
159 160
    case "$arg" in
      # these get passed explicitly to mysqld
161 162 163 164
      --basedir=*) MY_BASEDIR_VERSION="$val" ;;
      --datadir=*) DATADIR="$val" ;;
      --pid-file=*) pid_file="$val" ;;
      --user=*) user="$val"; SET_USER=1 ;;
165

166
      # these might have been set in a [mysqld_safe] section of my.cnf
167
      # they are added to mysqld command line to override settings from my.cnf
168 169 170
      --log-error=*) err_log="$val" ;;
      --port=*) mysql_tcp_port="$val" ;;
      --socket=*) mysql_unix_port="$val" ;;
171

172
      # mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])!
173 174 175
      --core-file-size=*) core_file_size="$val" ;;
      --ledir=*) ledir="$val" ;;
      --mysqld=*) MYSQLD="$val" ;;
monty@donna.mysql.fi's avatar
monty@donna.mysql.fi committed
176
      --mysqld-version=*)
177 178 179 180 181 182
        if test -n "$val"
        then
          MYSQLD="mysqld-$val"
        else
          MYSQLD="mysqld"
        fi
183
        ;;
184 185 186
      --nice=*) niceness="$val" ;;
      --open-files-limit=*) open_files="$val" ;;
      --skip-kill-mysqld*) KILL_MYSQLD=0 ;;
187 188 189
      --syslog) want_syslog=1 ;;
      --skip-syslog) want_syslog=0 ;;
      --syslog-tag=*) syslog_tag="$val" ;;
190 191 192 193
      --timezone=*) TZ="$val"; export TZ; ;;

      --help) usage ;;

194 195 196
      *)
        if test -n "$pick_args"
        then
197
          append_arg_to_args "$arg"
198 199
        fi
        ;;
bk@work.mysql.com's avatar
bk@work.mysql.com committed
200 201 202 203
    esac
  done
}

204

205 206
#
# First, try to find BASEDIR and ledir (where mysqld is)
207 208 209 210 211 212 213 214 215
#

if echo '@pkgdatadir@' | grep '^@prefix@' > /dev/null
then
  relpkgdata=`echo '@pkgdatadir@' | sed -e 's,^@prefix@,,' -e 's,^/,,' -e 's,^,./,'`
else
  # pkgdatadir is not relative to prefix
  relpkgdata='@pkgdatadir@'
fi
216

bk@work.mysql.com's avatar
bk@work.mysql.com committed
217
MY_PWD=`pwd`
218
# Check for the directories we would expect from a binary release install
219
if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION"
bk@work.mysql.com's avatar
bk@work.mysql.com committed
220
then
221 222 223 224 225 226 227 228 229 230 231 232 233
  # BASEDIR is already overridden on command line.  Do not re-set.

  # Use BASEDIR to discover le.
  if test -x "$MY_BASEDIR_VERSION/libexec/mysqld"
  then
    ledir="$MY_BASEDIR_VERSION/libexec"
  else
    ledir="$MY_BASEDIR_VERSION/bin"
  fi
elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/bin/mysqld"
then
  MY_BASEDIR_VERSION="$MY_PWD"		# Where bin, share and data are
  ledir="$MY_PWD/bin"			# Where mysqld is
234
# Check for the directories we would expect from a source install
235
elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld"
bk@work.mysql.com's avatar
bk@work.mysql.com committed
236
then
237 238
  MY_BASEDIR_VERSION="$MY_PWD"		# Where libexec, share and var are
  ledir="$MY_PWD/libexec"		# Where mysqld is
239
# Since we didn't find anything, used the compiled-in defaults
bk@work.mysql.com's avatar
bk@work.mysql.com committed
240
else
241 242
  MY_BASEDIR_VERSION='@prefix@'
  ledir='@libexecdir@'
bk@work.mysql.com's avatar
bk@work.mysql.com committed
243 244
fi

245

246 247 248 249 250 251 252
#
# Second, try to find the data directory
#

# Try where the binary installs put it
if test -d $MY_BASEDIR_VERSION/data/mysql
then
bk@work.mysql.com's avatar
bk@work.mysql.com committed
253
  DATADIR=$MY_BASEDIR_VERSION/data
tim@siva.hindu.god's avatar
tim@siva.hindu.god committed
254
  if test -z "$defaults" -a -r "$DATADIR/my.cnf"
255
  then
256
    defaults="--defaults-extra-file=$DATADIR/my.cnf"
257
  fi
258 259
# Next try where the source installs put it
elif test -d $MY_BASEDIR_VERSION/var/mysql
bk@work.mysql.com's avatar
bk@work.mysql.com committed
260 261
then
  DATADIR=$MY_BASEDIR_VERSION/var
262
# Or just give up and use our compiled-in default
bk@work.mysql.com's avatar
bk@work.mysql.com committed
263 264 265
else
  DATADIR=@localstatedir@
fi
266

267 268
if test -z "$MYSQL_HOME"
then 
269 270
  if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf"
  then
271 272 273 274 275
    log_error "WARNING: Found two instances of my.cnf -
$MY_BASEDIR_VERSION/my.cnf and
$DATADIR/my.cnf
IGNORING $DATADIR/my.cnf"

276 277 278
    MYSQL_HOME=$MY_BASEDIR_VERSION
  elif test -r "$DATADIR/my.cnf"
  then
279 280 281
    log_error "WARNING: Found $DATADIR/my.cnf
The data directory is a deprecated location for my.cnf, please move it to
$MY_BASEDIR_VERSION/my.cnf"
282 283 284 285
    MYSQL_HOME=$DATADIR
  else
    MYSQL_HOME=$MY_BASEDIR_VERSION
  fi
286 287
fi
export MYSQL_HOME
bk@work.mysql.com's avatar
bk@work.mysql.com committed
288

289

290
# Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe]
bk@work.mysql.com's avatar
bk@work.mysql.com committed
291
# and then merge with the command line arguments
292 293 294 295
if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults"
then
  print_defaults="$MY_BASEDIR_VERSION/bin/my_print_defaults"
elif test -x ./bin/my_print_defaults
296
then
bk@work.mysql.com's avatar
bk@work.mysql.com committed
297
  print_defaults="./bin/my_print_defaults"
298 299
elif test -x @bindir@/my_print_defaults
then
bk@work.mysql.com's avatar
bk@work.mysql.com committed
300
  print_defaults="@bindir@/my_print_defaults"
301 302
elif test -x @bindir@/mysql_print_defaults
then
bk@work.mysql.com's avatar
bk@work.mysql.com committed
303 304 305 306
  print_defaults="@bindir@/mysql_print_defaults"
else
  print_defaults="my_print_defaults"
fi
307

308 309 310 311
append_arg_to_args () {
  args="$args "`shell_quote_string "$1"`
}

312
args=
313

314
SET_USER=2
tsmith@build.mysql.com's avatar
tsmith@build.mysql.com committed
315
parse_arguments `$print_defaults $defaults --loose-verbose mysqld server`
316 317 318 319
if test $SET_USER -eq 2
then
  SET_USER=0
fi
320

tsmith@build.mysql.com's avatar
tsmith@build.mysql.com committed
321
parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld`
322
parse_arguments PICK-ARGS-FROM-ARGV "$@"
bk@work.mysql.com's avatar
bk@work.mysql.com committed
323

324
# Determine what logging facility to use
325 326 327 328 329 330 331

# Ensure that 'logger' exists, if it's requested
if [ $want_syslog -eq 1 ]
then
  my_which logger > /dev/null 2>&1
  if [ $? -ne 0 ]
  then
tsmith@ramayana.hindu.god's avatar
tsmith@ramayana.hindu.god committed
332 333
    log_error "--syslog requested, but no 'logger' program found.  Please ensure that 'logger' is in your PATH, or do not specify the --syslog option to mysqld_safe."
    exit 1
334 335 336 337
  fi
fi

if [ -n "$err_log" -o $want_syslog -eq 0 ]
338 339 340
then
  if [ -n "$err_log" ]
  then
tsmith@sita.local's avatar
tsmith@sita.local committed
341
    # mysqld adds ".err" if there is no extension on the --log-error
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
    # argument; must match that here, or mysqld_safe will write to a
    # different log file than mysqld

    # mysqld does not add ".err" to "--log-error=foo."; it considers a
    # trailing "." as an extension
    if expr "$err_log" : '.*\.[^/]*$' > /dev/null
    then
        :
    else
      err_log="$err_log".err
    fi

    case "$err_log" in
      /* ) ;;
      * ) err_log="$DATADIR/$err_log" ;;
    esac
  else
    err_log=$DATADIR/`@HOSTNAME@`.err
  fi

  append_arg_to_args "--log-error=$err_log"

364
  if [ $want_syslog -eq 1 ]
365 366
  then
    # User explicitly asked for syslog, so warn that it isn't used
367
    log_error "Can't log to error log and syslog at the same time.  Remove all --log-error configuration options for --syslog to take effect."
368 369
  fi

370 371 372 373 374 375 376 377 378 379 380 381 382
  # Log to err_log file
  log_notice "Logging to '$err_log'."
  logging=file
else
  if [ -n "$syslog_tag" ]
  then
    # Sanitize the syslog tag
    syslog_tag=`echo "$syslog_tag" | sed -e 's/[^a-zA-Z0-9_-]/_/g'`
    syslog_tag_mysqld_safe="${syslog_tag_mysqld_safe}-$syslog_tag"
    syslog_tag_mysqld="${syslog_tag_mysqld}-$syslog_tag"
  fi
  log_notice "Logging to syslog."
  logging=syslog
383 384
fi

385 386 387 388 389 390 391 392
USER_OPTION=""
if test -w / -o "$USER" = "root"
then
  if test "$user" != "root" -o $SET_USER = 1
  then
    USER_OPTION="--user=$user"
  fi
  # Change the err log to the right user, if it is in use
393
  if [ $want_syslog -eq 0 ]; then
394 395 396 397 398 399 400 401 402 403
    touch $err_log
    chown $user $err_log
  fi
  if test -n "$open_files"
  then
    ulimit -n $open_files
    append_arg_to_args "--open-files-limit=$open_files"
  fi
fi

404
safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
405 406 407 408 409 410
# Make sure that directory for $safe_mysql_unix_port exists
mysql_unix_port_dir=`dirname $safe_mysql_unix_port`
if [ ! -d $mysql_unix_port_dir ]
then
  mkdir $mysql_unix_port_dir
  chown $user $mysql_unix_port_dir
411
  chmod 755 $mysql_unix_port_dir
412 413
fi

kent@mysql.com's avatar
kent@mysql.com committed
414
# If the user doesn't specify a binary, we assume name "mysqld"
415 416
if test -z "$MYSQLD"
then
kent@mysql.com's avatar
kent@mysql.com committed
417
  MYSQLD=mysqld
418
fi
419

420
if test ! -x "$ledir/$MYSQLD"
bk@work.mysql.com's avatar
bk@work.mysql.com committed
421
then
422 423 424 425
  log_error "The file $ledir/$MYSQLD
does not exist or is not executable. Please cd to the mysql installation
directory and restart this script from there as follows:
./bin/mysqld_safe&
426
See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information"
427
  exit 1
bk@work.mysql.com's avatar
bk@work.mysql.com committed
428 429
fi

430 431
if test -z "$pid_file"
then
432
  pid_file="$DATADIR/`@HOSTNAME@`.pid"
433 434 435 436 437 438
else
  case "$pid_file" in
    /* ) ;;
    * )  pid_file="$DATADIR/$pid_file" ;;
  esac
fi
439 440
append_arg_to_args "--pid-file=$pid_file"

441 442
if test -n "$mysql_unix_port"
then
443
  append_arg_to_args "--socket=$mysql_unix_port"
444 445 446
fi
if test -n "$mysql_tcp_port"
then
447
  append_arg_to_args "--port=$mysql_tcp_port"
448
fi
bk@work.mysql.com's avatar
bk@work.mysql.com committed
449

450 451 452 453 454 455
if test $niceness -eq 0
then
  NOHUP_NICENESS="nohup"
else
  NOHUP_NICENESS="nohup nice -$niceness"
fi
456 457 458 459 460 461 462

# Using nice with no args to get the niceness level is GNU-specific.
# This check could be extended for other operating systems (e.g.,
# BSD could use "nohup sh -c 'ps -o nice -p $$' | tail -1").
# But, it also seems that GNU nohup is the only one which messes
# with the priority, so this is okay.
if nohup nice > /dev/null 2>&1
463
then
464
    normal_niceness=`nice`
465
    nohup_niceness=`nohup nice 2>/dev/null`
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485

    numeric_nice_values=1
    for val in $normal_niceness $nohup_niceness
    do
        case "$val" in
            -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | \
             [0-9] |  [0-9][0-9] |  [0-9][0-9][0-9] )
                ;;
            * )
                numeric_nice_values=0 ;;
        esac
    done

    if test $numeric_nice_values -eq 1
    then
        nice_value_diff=`expr $nohup_niceness - $normal_niceness`
        if test $? -eq 0 && test $nice_value_diff -gt 0 && \
            nice --$nice_value_diff echo testing > /dev/null 2>&1
        then
            # nohup increases the priority (bad), and we are permitted
486 487 488 489
            # to lower the priority with respect to the value the user
            # might have been given
            niceness=`expr $niceness - $nice_value_diff`
            NOHUP_NICENESS="nice -$niceness nohup"
490 491 492 493 494 495 496 497 498 499
        fi
    fi
else
    if nohup echo testing > /dev/null 2>&1
    then
        :
    else
        # nohup doesn't work on this system
        NOHUP_NICENESS=""
    fi
bk@work.mysql.com's avatar
bk@work.mysql.com committed
500 501
fi

igreenhoe@mysql.com's avatar
igreenhoe@mysql.com committed
502 503 504 505 506
# Try to set the core file size (even if we aren't root) because many systems
# don't specify a hard limit on core file size.
if test -n "$core_file_size"
then
  ulimit -c $core_file_size
507
fi
bk@work.mysql.com's avatar
bk@work.mysql.com committed
508 509 510 511 512 513 514 515 516 517 518

#
# If there exists an old pid file, check if the daemon is already running
# Note: The switches to 'ps' may depend on your operating system
if test -f $pid_file
then
  PID=`cat $pid_file`
  if @CHECK_PID@
  then
    if @FIND_PROC@
    then    # The pid contains a mysqld process
519
      log_error "A mysqld process already exists"
520
      exit 1
bk@work.mysql.com's avatar
bk@work.mysql.com committed
521 522 523 524 525
    fi
  fi
  rm -f $pid_file
  if test -f $pid_file
  then
526 527 528 529
    log_error "Fatal error: Can't remove the pid file:
$pid_file
Please remove it manually and start $0 again;
mysqld daemon not started"
530
    exit 1
bk@work.mysql.com's avatar
bk@work.mysql.com committed
531 532 533 534
  fi
fi

#
535 536 537 538 539 540
# Uncomment the following lines if you want all tables to be automatically
# checked and repaired during startup. You should add sensible key_buffer
# and sort_buffer values to my.cnf to improve check performance or require
# less disk space.
# Alternatively, you can start mysqld with the "myisam-recover" option. See
# the manual for details.
bk@work.mysql.com's avatar
bk@work.mysql.com committed
541 542
#
# echo "Checking tables in $DATADIR"
543 544
# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI
# $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM
bk@work.mysql.com's avatar
bk@work.mysql.com committed
545 546 547 548 549 550 551

# Does this work on all systems?
#if type ulimit | grep "shell builtin" > /dev/null
#then
#  ulimit -n 256 > /dev/null 2>&1		# Fix for BSD and FreeBSD systems
#fi

552 553 554 555 556 557 558 559 560 561 562 563
cmd="$NOHUP_NICENESS"

for i in  "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
  "--datadir=$DATADIR" "$USER_OPTION"
do
  cmd="$cmd "`shell_quote_string "$i"`
done
cmd="$cmd $args"
# Avoid 'nohup: ignoring input' warning
test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null"

log_notice "Starting $MYSQLD daemon with databases from $DATADIR"
bk@work.mysql.com's avatar
bk@work.mysql.com committed
564 565
while true
do
566
  rm -f $safe_mysql_unix_port $pid_file	# Some extra safety
567

568
  eval_log_error "$cmd"
569

bk@work.mysql.com's avatar
bk@work.mysql.com committed
570 571
  if test ! -f $pid_file		# This is removed if normal shutdown
  then
572
    break
bk@work.mysql.com's avatar
bk@work.mysql.com committed
573
  fi
574

575
  if @TARGET_LINUX@ && test $KILL_MYSQLD -eq 1
bk@work.mysql.com's avatar
bk@work.mysql.com committed
576 577 578 579 580 581
  then
    # Test if one process was hanging.
    # This is only a fix for Linux (running as base 3 mysqld processes)
    # but should work for the rest of the servers.
    # The only thing is ps x => redhat 5 gives warnings when using ps -x.
    # kill -9 is used or the process won't react on the kill.
582
    numofproces=`ps xaww | grep -v "grep" | grep "$ledir/$MYSQLD\>" | grep -c "pid-file=$pid_file"`
patg@krsna.patg.net's avatar
patg@krsna.patg.net committed
583

584
    log_notice "Number of processes running now: $numofproces"
bk@work.mysql.com's avatar
bk@work.mysql.com committed
585 586 587
    I=1
    while test "$I" -le "$numofproces"
    do 
588
      PROC=`ps xaww | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "pid-file=$pid_file" | sed -n '$p'` 
serg@serg.mylan's avatar
serg@serg.mylan committed
589 590 591 592 593 594 595

      for T in $PROC
      do
        break
      done
      #    echo "TEST $I - $T **"
      if kill -9 $T
patg@krsna.patg.net's avatar
patg@krsna.patg.net committed
596
      then
597 598
        log_error "$MYSQLD process hanging, pid $T - killed"
      else
serg@serg.mylan's avatar
serg@serg.mylan committed
599
        break
patg@krsna.patg.net's avatar
patg@krsna.patg.net committed
600
      fi
serg@serg.mylan's avatar
serg@serg.mylan committed
601
      I=`expr $I + 1`
bk@work.mysql.com's avatar
bk@work.mysql.com committed
602 603
    done
  fi
604
  log_notice "mysqld restarted"
bk@work.mysql.com's avatar
bk@work.mysql.com committed
605 606
done

607
log_notice "mysqld from pid file $pid_file ended"
serg@serg.mylan's avatar
serg@serg.mylan committed
608