summaryrefslogtreecommitdiff
path: root/support-files/mysql.server.sh
diff options
context:
space:
mode:
authorunknown <tim@threads.polyesthetic.msg>2000-11-29 18:24:21 -0500
committerunknown <tim@threads.polyesthetic.msg>2000-11-29 18:24:21 -0500
commitaa5540a47599a15322e8777580b954a9875b56e7 (patch)
tree6cab0c33c586cdfecf544834330147557123785c /support-files/mysql.server.sh
parentd3cce712223312cd1f3341e462918162f4261246 (diff)
downloadmariadb-git-aa5540a47599a15322e8777580b954a9875b56e7.tar.gz
More changes to mysql.server to make it fit in with the other
tools. support-files/mysql.server.sh: - Look for basedir in /etc/my.cnf if my_print_defaults can't be found - use `@HOSTNAME@`.pid instead of mysqld.pid for pid_file, to match safe_mysqld
Diffstat (limited to 'support-files/mysql.server.sh')
-rw-r--r--support-files/mysql.server.sh40
1 files changed, 32 insertions, 8 deletions
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index 9d66fb8d13e..2fe27192762 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -18,10 +18,9 @@
# in the /etc/my.cnf or other configuration files.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
-
export PATH
-mode=$1
+mode=$1 # start or stop
parse_arguments() {
for arg do
@@ -33,7 +32,7 @@ parse_arguments() {
done
}
-# Get arguments from the my.cfg file, group [mysqld]
+# Get arguments from the my.cfg file, groups [mysqld] and [mysql_server]
if test -x ./bin/my_print_defaults
then
print_defaults="./bin/my_print_defaults"
@@ -44,7 +43,31 @@ elif test -x @bindir@/mysql_print_defaults
then
print_defaults="@bindir@/mysql_print_defaults"
else
- print_defaults="my_print_defaults"
+ # Try to find basedir in /etc/my.cnf
+ conf=/etc/my.cnf
+ print_defaults=
+ if test -r $conf
+ then
+ subpat='^[^=]*basedir[^=]*=\(.*\)$'
+ dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
+ for d in $dirs
+ do
+ d=`echo $d | sed -e 's/[ ]//g'`
+ if test -x "$d/bin/my_print_defaults"
+ then
+ print_defaults="$d/bin/my_print_defaults"
+ break
+ fi
+ if test -x "$d/bin/mysql_print_defaults"
+ then
+ print_defaults="$d/bin/mysql_print_defaults"
+ break
+ fi
+ done
+ fi
+
+ # Hope it's in the PATH ... but I doubt it
+ test -z "$print_defaults" && print_defaults="my_print_defaults"
fi
datadir=@localstatedir@
@@ -61,7 +84,7 @@ else
fi
if test -z "$pid_file"
then
- pid_file=$datadir/mysqld.pid
+ pid_file=$datadir/`@HOSTNAME@`.pid
else
case "$pid_file" in
/* ) ;;
@@ -103,9 +126,10 @@ case "$mode" in
sleep 1
while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
- do [ -z "$flags" ] && echo "Wait for mysqld to exit\c" || echo ".\c"
- flags=a$flags
- sleep 1
+ do
+ [ -z "$flags" ] && echo "Wait for mysqld to exit\c" || echo ".\c"
+ flags=a$flags
+ sleep 1
done
if [ -s $pid_file ]
then echo " gave up waiting!"