--- mysqld_safe.orig 2005-12-05 10:48:47.000000000 -0800 +++ mysqld_safe 2005-12-05 10:49:03.000000000 -0800 @@ -325,20 +325,24 @@ #then # ulimit -n 256 > /dev/null 2>&1 # Fix for BSD and FreeBSD systems #fi - -echo "`date +'%y%m%d %H:%M:%S mysqld started'`" >> $err_log -while true -do - rm -f $safe_mysql_unix_port $pid_file # Some extra safety - if test -z "$args" - then - $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file --skip-locking >> $err_log 2>&1 - else - eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file --skip-locking $args >> $err_log 2>&1" - fi - if test ! -f $pid_file # This is removed if normal shutdown - then - echo "STOPPING server from pid file $pid_file" + echo "`date +'%y%m%d %H:%M:%S mysqld started'`" >> $err_log + trap 'kill `cat $pid_file`' 15 + while true + do + rm -f $safe_mysql_unix_port $pid_file # Some extra safety + if test -z "$args" + then + $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file --skip-locking >> $err_log 2>&1 & + else + eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file --skip-locking $args >> $err_log 2>&1" & + fi + while true; do + wait # use of wait and trap may be non-portable + test $? -gt 128 || break + done + if test ! -f $pid_file # This is removed if normal shutdown + then + echo "STOPPING server from pid file $pid_file" break fi