Bug #898 | init.d mysql.server has problems with non-standard install location | ||
---|---|---|---|
Submitted: | 23 Jul 2003 7:43 | Modified: | 4 Aug 2004 14:05 |
Reporter: | James Ponder | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Installing | Severity: | S3 (Non-critical) |
Version: | 3.23.57 | OS: | Linux (Linux SuSE SLES 8) |
Assigned to: | Lenz Grimmer | CPU Architecture: | Any |
[23 Jul 2003 7:43]
James Ponder
[23 Jul 2003 8:22]
James Ponder
A better diff file: --- support-files/mysql.server 2003-06-06 16:03:50.000000000 +0100 +++ /etc/init.d/mysql.server 2003-07-23 16:21:31.000000000 +0100 @@ -33,39 +33,15 @@ # 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. +# - Add the path to the mysql-installation-directory to the default_basedir +# variable below. # # If you want to affect other MySQL variables, you should make your changes # in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files. -basedir= - # The following variables are only set for letting mysql.server find things. - -# Set some defaults -datadir=/usr/local/mysql/data -pid_file= -if test -z "$basedir" -then - basedir=/usr/local/mysql - bindir=./bin -else - bindir="$basedir/bin" -fi - -PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin -export PATH - -if test -z "$pid_file" -then - pid_file=$datadir/`/bin/hostname`.pid -else - case "$pid_file" in - /* ) ;; - * ) pid_file="$datadir/$pid_file" ;; - esac -fi +default_basedir=/usr/local/mysql +default_datadir=$default_basedir/data mode=$1 # start or stop @@ -81,15 +57,10 @@ # Get arguments from the my.cnf file, # groups [mysqld] [mysql_server] and [mysql.server] -if test -x ./bin/my_print_defaults -then +if test -x ./bin/my_print_defaults; then print_defaults="./bin/my_print_defaults" -elif test -x $bindir/my_print_defaults -then - print_defaults="$bindir/my_print_defaults" -elif test -x $bindir/mysql_print_defaults -then - print_defaults="$bindir/mysql_print_defaults" +elif test -x ./bin/mysql_print_defaults; then + print_defaults="./bin/mysql_print_defaults" else # Try to find basedir in /etc/my.cnf conf=/etc/my.cnf @@ -118,8 +89,36 @@ test -z "$print_defaults" && print_defaults="my_print_defaults" fi +basedir= + parse_arguments `$print_defaults mysqld mysql_server mysql.server` +if test -n "$basedir"; then + default_datadir=$basedir/data +fi + +test -z "$basedir" && basedir=$default_basedir +test -z "$datadir" && datadir=$default_datadir + +if test -z "$pid_file" +then + pid_file=$datadir/`/bin/hostname`.pid +else + case "$pid_file" in + /* ) ;; + * ) pid_file="$datadir/$pid_file" ;; + esac +fi + +if test ! -d "$basedir"; then + echo "The base directory '$basedir' does not exist." + echo "If your MySQL is installed in another location, please configure your" + echo "/etc/my.cnf file." + exit 2 +fi + +bindir=$basedir/bin + # Safeguard (relative paths, core dumps..) cd $basedir @@ -170,7 +169,7 @@ rm /var/lock/subsys/mysql fi else - echo "No mysqld pid file found. Looked for $pid_file." + echo "No mysqld pid file found at $pid_file." fi ;;
[29 Jul 2003 12:40]
Lenz Grimmer
Thanks for your suggestions - I will look into them.
[4 Aug 2004 14:05]
Lenz Grimmer
A similar fix to this one has been applied to the 4.0 mysql.server startup script by now - it will not be fixed for 3.23.