Commit 3853ff4d authored by unknown's avatar unknown

scripts/safe_mysqld.sh

     - fix setting of niceness level

support-files/mysql.server.sh
     - applied some fixes from 4.0 mysql.server script
     - fix my.cnf parsing


scripts/safe_mysqld.sh:
   - fix setting of niceness level, if one adds "renice -20 $$" to safe_mysqld
     as hinted in the manual (which could result in NOHUP_NICENESS having a
     value of "-15" and hence there would be one dash too much)
support-files/mysql.server.sh:
   - applied some fixes from 4.0 mysql.server script
   - fix to actually parse the documented section ([mysql.server] not
     [mysql_server]) in my.cnf on startup
parent a073857c
...@@ -159,7 +159,7 @@ then ...@@ -159,7 +159,7 @@ then
NOHUP_NICENESS=`nohup nice 2>&1` NOHUP_NICENESS=`nohup nice 2>&1`
if test $? -eq 0 && test x"$NOHUP_NICENESS" != x0 && nice --1 echo foo > /dev/null 2>&1 if test $? -eq 0 && test x"$NOHUP_NICENESS" != x0 && nice --1 echo foo > /dev/null 2>&1
then then
NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup" NOHUP_NICENESS="nice -n $NOHUP_NICENESS nohup"
else else
NOHUP_NICENESS="nohup" NOHUP_NICENESS="nohup"
fi fi
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB # Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind # This file is public domain and comes with NO WARRANTY of any kind
# Mysql daemon start/stop script. # MySQL daemon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based # Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql. # systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
...@@ -20,21 +20,31 @@ ...@@ -20,21 +20,31 @@
# Required-Stop: $local_fs $network $remote_fs # Required-Stop: $local_fs $network $remote_fs
# Default-Start: 3 5 # Default-Start: 3 5
# Default-Stop: 3 5 # Default-Stop: 3 5
# Short-Description: start and stop MySLQ # Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine. # Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO ### END INIT INFO
# If you install MySQL on some other places than @prefix@, then you
# The following variables are only set for letting mysql.server find things. # have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
# [mysqld]
# basedir=<path-to-mysql-installation-directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
# and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
# below.
#
# If you want to affect other MySQL variables, you should make your changes # If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf or other configuration files. # in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
PATH=/sbin:/usr/sbin:/bin:/usr/bin basedir=
export PATH
# The following variables are only set for letting mysql.server find things.
# Set some defaults # Set some defaults
datadir=@localstatedir@ datadir=@localstatedir@
basedir=
pid_file= pid_file=
if test -z "$basedir" if test -z "$basedir"
then then
...@@ -43,6 +53,10 @@ then ...@@ -43,6 +53,10 @@ then
else else
bindir="$basedir/bin" bindir="$basedir/bin"
fi fi
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
export PATH
if test -z "$pid_file" if test -z "$pid_file"
then then
pid_file=$datadir/`@HOSTNAME@`.pid pid_file=$datadir/`@HOSTNAME@`.pid
...@@ -65,7 +79,7 @@ parse_arguments() { ...@@ -65,7 +79,7 @@ parse_arguments() {
done done
} }
# Get arguments from the my.cnf file, groups [mysqld] and [mysql_server] # Get arguments from the my.cnf file, groups [mysqld] and [mysql.server]
if test -x ./bin/my_print_defaults if test -x ./bin/my_print_defaults
then then
print_defaults="./bin/my_print_defaults" print_defaults="./bin/my_print_defaults"
...@@ -103,7 +117,7 @@ else ...@@ -103,7 +117,7 @@ else
test -z "$print_defaults" && print_defaults="my_print_defaults" test -z "$print_defaults" && print_defaults="my_print_defaults"
fi fi
parse_arguments `$print_defaults $defaults mysqld mysql_server` parse_arguments `$print_defaults $defaults mysqld mysql.server`
# Safeguard (relative paths, core dumps..) # Safeguard (relative paths, core dumps..)
cd $basedir cd $basedir
...@@ -123,14 +137,14 @@ case "$mode" in ...@@ -123,14 +137,14 @@ case "$mode" in
touch /var/lock/subsys/mysql touch /var/lock/subsys/mysql
fi fi
else else
echo "Can't execute $bindir/safe_mysqld" echo "Can't execute $bindir/safe_mysqld from dir $basedir"
fi fi
;; ;;
'stop') 'stop')
# Stop daemon. We use a signal here to avoid having to know the # Stop daemon. We use a signal here to avoid having to know the
# root password. # root password.
if test -f "$pid_file" if test -s "$pid_file"
then then
mysqld_pid=`cat $pid_file` mysqld_pid=`cat $pid_file`
echo "Killing mysqld with pid $mysqld_pid" echo "Killing mysqld with pid $mysqld_pid"
...@@ -140,7 +154,7 @@ case "$mode" in ...@@ -140,7 +154,7 @@ case "$mode" in
sleep 1 sleep 1
while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ] while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
do do
[ -z "$flags" ] && echo "Wait for mysqld to exit\c" || echo ".\c" [ -z "$flags" ] && echo -n "Wait for mysqld to exit" || echo -n "."
flags=a$flags flags=a$flags
sleep 1 sleep 1
done done
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment