diff options
author | unknown <monty@mishka.local> | 2005-04-16 11:40:41 +0300 |
---|---|---|
committer | unknown <monty@mishka.local> | 2005-04-16 11:40:41 +0300 |
commit | ca662711413c4d053b4e6f9579a5d4a342a338a0 (patch) | |
tree | b15a81fcb611b2eab3be0b305bef4d678b7b7ec2 /support-files/mysql.server.sh | |
parent | 48faa137af3d610228041d221363a3e574c137f8 (diff) | |
download | mariadb-git-ca662711413c4d053b4e6f9579a5d4a342a338a0.tar.gz |
Set bindir, datadir & others if --basedir is given. This ensures that one only has to set basedir in [mysqld] group when moving a binary installation to a not default polace
Use for now safe_mysqld by default. (unless use-manager is set in the [mysql.server] option in my.cnf)
Search first for defaults files in basedir and then in datadir (like mysqld_safe)
support-files/mysql.server.sh:
Set bindir, datadir & others if --basedir is given. This ensures that one only has to set basedir in [mysqld] group when moving a binary installation to a not default polace
Use for now safe_mysqld by default. (unless use-manager is set in the [mysql.server] option in my.cnf)
Search first for defaults files in basedir and then in datadir (like mysqld_safe)
I removed the test for localstatedir as default.c doesn't anymore read defaults files from localstatedir
Diffstat (limited to 'support-files/mysql.server.sh')
-rw-r--r-- | support-files/mysql.server.sh | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index 04fd9a312da..071b7696908 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -49,6 +49,7 @@ datadir= # Set some defaults pid_file= server_pid_file= +use_mysqld_safe=1 user=@MYSQLD_USER@ if test -z "$basedir" then @@ -59,6 +60,7 @@ then libexecdir=@libexecdir@ else bindir="$basedir/bin" + datadir="$basedir/data" sbindir="$basedir/bin" libexecdir="$basedir/bin" fi @@ -94,10 +96,17 @@ esac parse_server_arguments() { for arg do case "$arg" in - --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; + --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` + bindir="$basedir/bin" + datadir="$basedir/data" + sbindir="$basedir/bin" + libexecdir="$basedir/bin" + ;; --datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --pid-file=*) server_pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; + --use-mysqld_safe) use_mysqld_safe=1;; + --use-manager) use_mysqld_safe=0;; esac done } @@ -178,14 +187,19 @@ else fi # -# Test if someone changed datadir; In this case we should also read the -# default arguments from this directory +# Read defaults file from 'basedir'. If there is no defaults file there +# check if it's in the old (depricated) place (datadir) and read it from there # extra_args="" -if test "$datadir" != "@localstatedir@" +if test -r "$basedir/my.cnf" then - extra_args="-e $datadir/my.cnf" + extra_args="-e $basedir/my.cnf" +else + if test -r "$datadir/my.cnf" + then + extra_args="-e $datadir/my.cnf" + fi fi parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server` @@ -231,11 +245,11 @@ case "$mode" in manager=$sbindir/mysqlmanager fi - if test -x $manager + echo $echo_n "Starting MySQL" + if test -x $manager -a "$use_mysqld_safe" = "0" then # Give extra arguments to mysqld with the my.cnf file. This script may # be overwritten at next upgrade. - echo $echo_n "Starting MySQL" $manager --user=$user --pid-file=$pid_file >/dev/null 2>&1 & wait_for_pid created @@ -246,8 +260,8 @@ case "$mode" in fi elif test -x $bindir/mysqld_safe then - # Give extra arguments to mysqld with the my.cnf file. This script may be overwritten at next upgrade. - echo $echo_n "Starting MySQL" + # Give extra arguments to mysqld with the my.cnf file. This script + # may be overwritten at next upgrade. pid_file=$server_pid_file $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file >/dev/null 2>&1 & wait_for_pid created |