All pastes #32717 Raw Edit

Someone

public text v1 · immutable
#32717 ·published 2005-12-06 22:31 UTC
rendered paste body
--- mysqld_safe.old     2005-12-06 22:30:27.000000000 +0000
+++ mysqld_safe 2005-12-06 22:29:15.000000000 +0000
@@ -327,15 +327,20 @@
 #fi

 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
+    $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"
+    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"