--- scripts/safe_mysqld.sh.orig	Mon Jan 10 16:49:29 2000
+++ scripts/safe_mysqld.sh	Mon Aug 14 05:01:01 2000
@@ -12,33 +12,9 @@
 
 trap '' 1 2 3 15			# we shouldn't let anyone kill us
 
-# Check if we are starting this relative (for the binary release)
-if test -d ./data/mysql -a -f ./share/mysql/english/errmsg.sys -a \
- -x ./bin/mysqld
-then
-  MY_BASEDIR_VERSION=`pwd`		# Where bin, share and data are
-  DATADIR=$MY_BASEDIR_VERSION/data	# Where the databases are
-  ledir=$MY_BASEDIR_VERSION/bin		# Where mysqld is
-# Check if this is a 'moved install directory'
-elif test -f ./var/mysql/db.frm -a -f ./share/mysql/english/errmsg.sys -a \
- -x ./libexec/mysqld
-then
-  MY_BASEDIR_VERSION=`pwd`		# Where libexec, share and var are
-  DATADIR=$MY_BASEDIR_VERSION/var	# Where the databases are
-  ledir=$MY_BASEDIR_VERSION/libexec	# Where mysqld is
-else
-  MY_BASEDIR_VERSION=@prefix@
-  DATADIR=@localstatedir@
-  ledir=@libexecdir@
-  if test ! -x $ledir/mysqld
-  then
-    echo "The file $ledir/mysqld doesn't exist or is not executable"
-    echo "Please do a cd to the mysql installation directory and restart"
-    echo "this script from there as follows:"
-    echo "./bin/safe_mysqld".
-    exit 1;
-  fi
-fi
+MY_BASEDIR_VERSION=@prefix@
+DATADIR=@localstatedir@
+ledir=@libexecdir@
 
 pid_file=$DATADIR/`@HOSTNAME@`.pid
 log=$DATADIR/`@HOSTNAME@`.log
@@ -104,10 +80,10 @@
 #export MYSQL_TCP_PORT
 
 # 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
+if type ulimit | grep "shell builtin" > /dev/null
+then
+  ulimit -n 256 > /dev/null 2>&1		# Fix for BSD and FreeBSD systems
+fi
 
 echo "mysqld started on " `date` >> $err_log
 while true
@@ -116,41 +92,14 @@
   if test "$#" -eq 0
   then
     nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \
-     @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
+     @MYSQLD_DEFAULT_SWITCHES@ --user=mysql >> $err_log 2>&1
   else
     nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \
-     @MYSQLD_DEFAULT_SWITCHES@ "$@" >> $err_log 2>&1
+     @MYSQLD_DEFAULT_SWITCHES@ --user=mysql "$@" >> $err_log 2>&1
   fi
   if test ! -f $pid_file		# This is removed if normal shutdown
   then
     break;
-  fi
-  if @IS_LINUX@
-  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.
-    numofproces=`ps x | grep -v "grep" | grep -c $ledir/mysqld`
-    echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
-    I=1
-    while test "$I" -le "$numofproces"
-    do 
-      PROC=`ps x | grep $ledir/mysqld | grep -v "grep" | tail -1` 
-	for T in $PROC
-	do
-	  break
-	done
-	#    echo "TEST $I - $T **"
-	if kill -9 $T
-	then
-	  echo "mysqld process hanging, pid $T - killed" | tee -a $err_log
-	else 
-	  break
-	fi
-	I=`expr $I + 1`
-    done
   fi
   echo "mysqld restarted on " `date` | tee -a $err_log
 done
