summaryrefslogtreecommitdiff
path: root/scripts/mysqld_safe.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mysqld_safe.sh')
-rw-r--r--scripts/mysqld_safe.sh35
1 files changed, 27 insertions, 8 deletions
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index e400c27b84c..d7e3eedb84e 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -10,6 +10,8 @@
# mysql.server works by first doing a cd to the base directory and from there
# executing mysqld_safe
+KILL_MYSQLD=1;
+
trap '' 1 2 3 15 # we shouldn't let anyone kill us
umask 007
@@ -34,6 +36,9 @@ parse_arguments() {
for arg do
case "$arg" in
+ --skip-kill-mysqld*)
+ KILL_MYSQLD=0;
+ ;;
# these get passed explicitly to mysqld
--basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;;
--datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;;
@@ -70,6 +75,7 @@ parse_arguments() {
MYSQLD="mysqld"
fi
;;
+ --nice=*) niceness=`echo "$arg" | sed -e "s;--nice=;;"` ;;
*)
if test -n "$pick_args"
then
@@ -82,6 +88,7 @@ parse_arguments() {
done
}
+
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 \
@@ -110,6 +117,7 @@ fi
MYSQL_UNIX_PORT=${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}
MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-@MYSQL_TCP_PORT@}
user=@MYSQLD_USER@
+niceness=0
# Use the mysqld-max binary by default if the user doesn't specify a binary
if test -x $ledir/mysqld-max
@@ -167,7 +175,12 @@ export MYSQL_UNIX_PORT
export MYSQL_TCP_PORT
-NOHUP_NICENESS="nohup"
+if test $niceness -eq 0
+then
+ NOHUP_NICENESS="nohup"
+else
+ NOHUP_NICENESS="nohup nice -$niceness"
+fi
# Using nice with no args to get the niceness level is GNU-specific.
# This check could be extended for other operating systems (e.g.,
@@ -198,8 +211,10 @@ then
nice --$nice_value_diff echo testing > /dev/null 2>&1
then
# nohup increases the priority (bad), and we are permitted
- # to lower the priority
- NOHUP_NICENESS="nice --$nice_value_diff nohup"
+ # 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"
fi
fi
else
@@ -259,12 +274,16 @@ then
fi
#
-# Uncomment the following lines if you want all tables to be automaticly
-# checked and repaired at start
+# 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.
#
# echo "Checking tables in $DATADIR"
-# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check -O key_buffer=64M -O sort_buffer=64M $DATADIR/*/*.MYI
-# $MY_BASEDIR_VERSION/bin/isamchk --silent --force -O sort_buffer=64M $DATADIR/*/*.ISM
+# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI
+# $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM
echo "Starting $MYSQLD daemon with databases from $DATADIR"
@@ -289,7 +308,7 @@ do
break
fi
- if @IS_LINUX@
+ 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)