openbsd-ports/databases/mysql/patches/patch-scripts_mysqld_safe_sh

102 lines
3.0 KiB
Plaintext
Raw Normal View History

2004-05-24 18:40:28 -04:00
$OpenBSD: patch-scripts_mysqld_safe_sh,v 1.6 2004/05/24 22:40:28 brad Exp $
2004-05-21 08:16:21 -04:00
--- scripts/mysqld_safe.sh.orig 2004-05-13 20:53:19.000000000 -0400
2004-05-24 18:40:28 -04:00
+++ scripts/mysqld_safe.sh 2004-05-24 18:35:56.000000000 -0400
2004-02-21 20:20:11 -05:00
@@ -90,32 +90,12 @@ parse_arguments() {
2003-12-30 00:58:51 -05:00
}
-MY_PWD=`pwd`
-# Check if we are starting this relative (for the binary release)
-if test -d $MY_PWD/data/mysql -a -f ./share/mysql/english/errmsg.sys -a \
- -x ./bin/mysqld
-then
- MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are
- ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is
- DATADIR=$MY_BASEDIR_VERSION/data
- if test -z "$defaults"
- then
- defaults="--defaults-extra-file=$MY_BASEDIR_VERSION/data/my.cnf"
- fi
-# 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=$MY_PWD # Where libexec, share and var are
- ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is
- DATADIR=$MY_BASEDIR_VERSION/var
-else
- MY_BASEDIR_VERSION=@prefix@
- DATADIR=@localstatedir@
- ledir=@libexecdir@
-fi
+MY_BASEDIR_VERSION=@prefix@
+ledir=@libexecdir@
+DATADIR=@localstatedir@
-user=@MYSQLD_USER@
+user=_mysql
+group=_mysql
niceness=0
# Use the mysqld-max binary by default if the user doesn't specify a binary
2004-02-21 20:20:11 -05:00
@@ -155,6 +135,7 @@ fi
parse_arguments `$print_defaults --loose-verbose $defaults mysqld_safe safe_mysqld`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
+socket_dir=`dirname $safe_mysql_unix_port`
if test ! -x $ledir/$MYSQLD
then
2004-05-24 18:40:28 -04:00
@@ -299,11 +280,12 @@ fi
2003-12-30 00:58:51 -05:00
echo "Starting $MYSQLD daemon with databases from $DATADIR"
2004-05-24 18:40:28 -04:00
-# Does this work on all systems?
2003-12-30 00:58:51 -05:00
-#if type ulimit | grep "shell builtin" > /dev/null
-#then
-# ulimit -n 256 > /dev/null 2>&1 # Fix for BSD and FreeBSD systems
-#fi
+if test ! -d $socket_dir
+then
+ mkdir -p $socket_dir
+ chown $user:$group $socket_dir
+ chmod 711 $socket_dir
+fi
echo "`date +'%y%m%d %H:%M:%S mysqld started'`" >> $err_log
while true
2004-05-24 18:40:28 -04:00
@@ -320,33 +302,6 @@ do
2003-12-30 00:58:51 -05:00
break
fi
- if test @IS_LINUX@ -a $KILL_MYSQLD -eq 1
- 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 xa | 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 xa | grep $ledir/$MYSQLD | grep -v "grep" | sed -n '$p'`
- 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 "`date +'%y%m%d %H:%M:%S'` mysqld restarted" | tee -a $err_log
done