summaryrefslogtreecommitdiff
path: root/support-files/mysql.server.sh
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-09-07 04:55:17 +0300
committerunknown <monty@donna.mysql.com>2000-09-07 04:55:17 +0300
commitbee9933ab83729e6ca2f2826706b1ab5b985df87 (patch)
treecd775f59b4803ef23e407df9d47af3ae7b517a13 /support-files/mysql.server.sh
parentaaca0e3c6bd71a7b34fcb3a137ab1113a20dca1f (diff)
downloadmariadb-git-bee9933ab83729e6ca2f2826706b1ab5b985df87.tar.gz
Small bug fixes
support-files/mysql.server-sys5.sh: Change mode to -rw-rw-r-- Docs/manual.texi: Added information about BeOS, Access 2000, AIX and user links client/mysql.cc: Fixed SOURCE to work on windows client/mysqldump.c: Strip of white space configure.in: Fix for AIX include/dbug.h: Assert handling include/my_pthread.h: Ia64 needs more thread stack than other processors include/my_sys.h: More comments myisam/mi_key.c: Fixed wrong key length checks mysql.proj: update mysys/charset.c: Cleanup mysys/mf_keycache.c: Moved SEC_LINK to file that used it mysys/my_static.h: Moved SEC_LINK to file that used it scripts/Makefile.am: Fix for debian scripts/mysql_install_db.sh: Cleanup sql/gen_lex_hash.cc: Better values sql/ha_berkeley.cc: Fix of reading of unique key sql/handler.cc: Fix memory allocation bug sql/mysqld.cc: Fix for Ia64 sql/share/charsets/latin1.conf: Fixed sortorder back to scandinavian. sql/sql_yacc.yy: FULL shouldn't be a keyword support-files/Makefile.am: Fix for debian support-files/mysql.server.sh: Cleanups
Diffstat (limited to 'support-files/mysql.server.sh')
-rw-r--r--support-files/mysql.server.sh94
1 files changed, 46 insertions, 48 deletions
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index f6a75e22fea..9f847467f1e 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -13,63 +13,61 @@
# chkconfig: 2345 90 90
# description: A very fast and reliable SQL database engine.
+# The following variables are only set for letting mysql.server find things
+# if you want to affect other MySQL variables, you should make your changes
+# in the /etc/my.cnf or other configuration files
+
PATH=/sbin:/usr/sbin:/bin:/usr/bin
basedir=@prefix@
bindir=@bindir@
+sbindir=@sbindir@
datadir=@localstatedir@
pid_file=@localstatedir@/mysqld.pid
-log_file=@localstatedir@/mysqld.log
-# Run mysqld as this user.
-mysql_daemon_user=@MYSQLD_USER@
+
export PATH
mode=$1
-if test -w / # determine if we should look at the root config file
-then # or user config file
- conf=/etc/my.cnf
-else
- conf=$HOME/.my.cnf # Using the users config file
-fi
-
-# The following code tries to get the variables safe_mysqld needs from the
-# config file. This isn't perfect as this ignores groups, but it should
-# work as the options doesn't conflict with anything else.
-
-if test -f "$conf" # Extract those fields we need from config file.
-then
- if grep "^datadir" $conf >/dev/null
- then
- datadir=`grep "^datadir" $conf | cut -f 2 -d= | tr -d ' '`
- fi
- if grep "^user" $conf >/dev/null
- then
- mysql_daemon_user=`grep "^user" $conf | cut -f 2 -d= | tr -d ' ' | head -1`
- fi
- if grep "^pid-file" $conf >/dev/null
- then
- pid_file=`grep "^pid-file" $conf | cut -f 2 -d= | tr -d ' '`
- else
- if test -d "$datadir"
- then
- pid_file=$datadir/`hostname`.pid
- fi
- fi
- if grep "^basedir" $conf >/dev/null
- then
- basedir=`grep "^basedir" $conf | cut -f 2 -d= | tr -d ' '`
- bindir=$basedir/bin
- fi
- if grep "^bindir" $conf >/dev/null
- then
- bindir=`grep "^bindir" $conf | cut -f 2 -d= | tr -d ' '`
- fi
- if grep "^log[ \t]*=" $conf >/dev/null
- then
- log_file=`grep "log[ \t]*=" $conf | cut -f 2 -d= | tr -d ' '`
- fi
-fi
+GetCNF () {
+
+VARIABLES="basedir bindir sbindir datadir pid-file"
+CONFIG_FILES="/etc/my.cnf $basedir/my.cnf $HOME/.my.cnf"
+
+for c in $CONFIG_FILES
+do
+ if [ -f $c ]
+ then
+ #echo "Processing $c..."
+ for v in $VARIABLES
+ do
+ # This method assumes last of duplicate $variable entries will be the
+ # value set ([mysqld])
+ # This could easily be rewritten to gather [xxxxx]-specific entries,
+ # but for now it looks like only the mysqld ones are needed for
+ # server startup scripts
+ eval `sed -n -e '/^$/d' -e '/^#/d' -e 's,[ ],,g' -e '/=/p' $c |\
+ awk -F= -v v=$v '{if ($1 == v) printf ("thevar=\"%s\"\n", $2)}'`
+
+ # it would be easier if the my.cnf and variable values were
+ # all matched, but since they aren't we need to map them here.
+ case $v in
+ pid-file) v=pid_file ;;
+ log) v=log_file ;;
+ esac
+
+ # As long as $thevar isn't blank, use it to set or override current
+ # value
+ [ "$thevar" != "" ] && eval $v=$thevar
+
+ done
+ #else
+ # echo "No $c config file."
+ fi
+done
+}
+# run function to get config values
+GetCNF
# Safeguard (relative paths, core dumps..)
cd $basedir
@@ -83,7 +81,7 @@ case "$mode" in
# Give extra arguments to mysqld with the my.cnf file. This script may
# be overwritten at next upgrade.
$bindir/safe_mysqld \
- --user=$mysql_daemon_user --datadir=$datadir --pid-file=$pid_file --log=$log_file &
+ --datadir=$datadir --pid-file=$pid_file &
else
echo "Can't execute $bindir/safe_mysqld"
fi