Commit 87e104e4 authored by unknown's avatar unknown

Fixed setup scripts to use mysqlmanager instead of mysqld_safe


server-tools/instance-manager/Makefile.am:
  obsolete defaults removed. Also changed default binary  placement. Now mysqlmanager should be installed in
  libexecdir (usually /usr/sbin)
server-tools/instance-manager/instance_options.cc:
  bug, resulted in skipping non-sepcially recognized mysqld options fixed
server-tools/instance-manager/user_map.cc:
  log message made a bit more verbose
support-files/mysql.server.sh:
  use mysqlmanager tp start mysqld
support-files/mysql.spec.sh:
  mysqlmanager should be placed in /usr/bin
parent ab432d6c
...@@ -30,9 +30,7 @@ liboptions_a_CPPFLAGS= $(CPPFLAGS) \ ...@@ -30,9 +30,7 @@ liboptions_a_CPPFLAGS= $(CPPFLAGS) \
-DDEFAULT_LOG_FILE_NAME="$(localstatedir)/mysqlmanager.log" \ -DDEFAULT_LOG_FILE_NAME="$(localstatedir)/mysqlmanager.log" \
-DDEFAULT_SOCKET_FILE_NAME="$(localstatedir)/mysqlmanager.sock" \ -DDEFAULT_SOCKET_FILE_NAME="$(localstatedir)/mysqlmanager.sock" \
-DDEFAULT_PASSWORD_FILE_NAME="$(sysconfdir)/mysqlmanager.passwd" \ -DDEFAULT_PASSWORD_FILE_NAME="$(sysconfdir)/mysqlmanager.passwd" \
-DDEFAULT_MYSQLD_PATH="$(bindir)/mysqld$(EXEEXT)" \ -DDEFAULT_MYSQLD_PATH="$(libexecdir)/mysqld$(EXEEXT)" \
-DDEFAULT_USER="root" \
-DDEFAULT_PASSWORD="" \
-DDEFAULT_MONITORING_INTERVAL="20" \ -DDEFAULT_MONITORING_INTERVAL="20" \
-DDEFAULT_PORT="2273" \ -DDEFAULT_PORT="2273" \
-DPROTOCOL_VERSION=@PROTOCOL_VERSION@ -DPROTOCOL_VERSION=@PROTOCOL_VERSION@
......
...@@ -225,6 +225,9 @@ int Instance_options::add_option(const char* option) ...@@ -225,6 +225,9 @@ int Instance_options::add_option(const char* option)
} }
} }
/* if we haven't returned earlier we should just save the option */
insert_dynamic(&options_array,(gptr) &tmp);
return 0; return 0;
err: err:
......
...@@ -129,7 +129,7 @@ int User_map::load(const char *password_file_name) ...@@ -129,7 +129,7 @@ int User_map::load(const char *password_file_name)
if ((file= my_fopen(password_file_name, O_RDONLY | O_BINARY, MYF(0))) == 0) if ((file= my_fopen(password_file_name, O_RDONLY | O_BINARY, MYF(0))) == 0)
{ {
/* Probably the password file wasn't specified. Try to leave without it */ /* Probably the password file wasn't specified. Try to leave without it */
log_info("can't open password file %s: errno=%d, %s", password_file_name, log_info("[WARNING] can't open password file %s: errno=%d, %s", password_file_name,
errno, strerror(errno)); errno, strerror(errno));
return 0; return 0;
} }
......
#!/bin/sh #!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB # Copyright (C) 2005 MySQL AB
# 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 server management 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/S99mysqlmanager and
# /etc/rc0.d/K01mysqlmanager
# When this is done the mysql server will be started when the machine is # When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down. # started and shut down when the systems goes down.
# Comments to support chkconfig on RedHat Linux # description: MySQL database server Instance Manager
# chkconfig: 2345 90 20
# description: A very fast and reliable SQL database engine.
# Comments to support LSB init script conventions # Comments to support LSB init script conventions
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: mysql # Provides: mysqlmanager
# Required-Start: $local_fs $network $remote_fs # Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs # Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: start and stop MySQL # Short-Description: start and stop MySQL Instance Manager
# Description: MySQL is a very fast and reliable SQL database engine. # Description: MySQL Instance Manager is used to start/stop/status/monitor
# MySQL server instances
### END INIT INFO ### END INIT INFO
# If you install MySQL on some other places than @prefix@, then you
# 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
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
basedir= basedir=
# The following variables are only set for letting mysql.server find things. # The following variables are only set for letting mysql.server find things.
...@@ -50,8 +35,10 @@ if test -z "$basedir" ...@@ -50,8 +35,10 @@ if test -z "$basedir"
then then
basedir=@prefix@ basedir=@prefix@
bindir=@bindir@ bindir=@bindir@
sbindir=@sbindir@
else else
bindir="$basedir/bin" bindir="$basedir/bin"
sbindir="$basedir/sbin"
fi fi
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
...@@ -65,11 +52,18 @@ case `echo "testing\c"`,`echo -n testing` in ...@@ -65,11 +52,18 @@ case `echo "testing\c"`,`echo -n testing` in
*) echo_n= echo_c='\c' ;; *) echo_n= echo_c='\c' ;;
esac esac
parse_arguments() { parse_server_arguments() {
for arg do for arg do
case "$arg" in case "$arg" in
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
esac
done
}
parse_manager_arguments() {
for arg do
case "$arg" in
--pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
esac esac
done done
...@@ -125,14 +119,16 @@ then ...@@ -125,14 +119,16 @@ then
extra_args="-e $datadir/my.cnf" extra_args="-e $datadir/my.cnf"
fi fi
parse_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server` parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
parse_manager_arguments `$print_defaults manager`
# #
# Set pid file if not given # Set pid file if not given
# #
if test -z "$pid_file" if test -z "$pid_file"
then then
pid_file=$datadir/`@HOSTNAME@`.pid pid_file=$datadir/mysqlmanager-`@HOSTNAME@`.pid
else else
case "$pid_file" in case "$pid_file" in
/* ) ;; /* ) ;;
...@@ -147,18 +143,18 @@ case "$mode" in ...@@ -147,18 +143,18 @@ case "$mode" in
'start') 'start')
# Start daemon # Start daemon
if test -x $bindir/mysqld_safe if test -x $sbindir/mysqlmanager
then then
# Give extra arguments to mysqld with the my.cnf file. This script may # Give extra arguments to mysqlmanager with the my.cnf file. This script may
# be overwritten at next upgrade. # be overwritten at next upgrade.
$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2>&1 & $sbindir/mysqlmanager "--pid-file=$pid_file" --run-as-service >/dev/null 2>&1 &
# Make lock for RedHat / SuSE # Make lock for RedHat / SuSE
if test -w /var/lock/subsys if test -w /var/lock/subsys
then then
touch /var/lock/subsys/mysql touch /var/lock/subsys/mysqlmanager
fi fi
else else
echo "Can't execute $bindir/mysqld_safe from dir $basedir" echo "Can't execute $sbindir/mysqlmanager from dir $basedir"
fi fi
;; ;;
...@@ -167,15 +163,15 @@ case "$mode" in ...@@ -167,15 +163,15 @@ case "$mode" in
# root password. # root password.
if test -s "$pid_file" if test -s "$pid_file"
then then
mysqld_pid=`cat $pid_file` mysqlmanager_pid=`cat $pid_file`
echo "Killing mysqld with pid $mysqld_pid" echo "Killing mysqlmanager with pid $mysqlmanager_pid"
kill $mysqld_pid kill $mysqlmanager_pid
# mysqld should remove the pid_file when it exits, so wait for it. # mysqlmanager should remove the pid_file when it exits, so wait for it.
sleep 1 sleep 1
while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ] while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
do do
[ -z "$flags" ] && echo $echo_n "Wait for mysqld to exit$echo_c" || echo $echo_n ".$echo_c" [ -z "$flags" ] && echo $echo_n "Wait for mysqlmanager to exit$echo_c" || echo $echo_n ".$echo_c"
flags=a$flags flags=a$flags
sleep 1 sleep 1
done done
...@@ -185,12 +181,12 @@ case "$mode" in ...@@ -185,12 +181,12 @@ case "$mode" in
then echo " done" then echo " done"
fi fi
# delete lock for RedHat / SuSE # delete lock for RedHat / SuSE
if test -f /var/lock/subsys/mysql if test -f /var/lock/subsys/mysqlmanager
then then
rm -f /var/lock/subsys/mysql rm -f /var/lock/subsys/mysqlmanager
fi fi
else else
echo "No mysqld pid file found. Looked for $pid_file." echo "No mysqlmanager pid file found. Looked for $pid_file."
fi fi
;; ;;
......
...@@ -515,6 +515,7 @@ fi ...@@ -515,6 +515,7 @@ fi
%attr(755, root, root) %{_bindir}/safe_mysqld %attr(755, root, root) %{_bindir}/safe_mysqld
%attr(755, root, root) %{_sbindir}/mysqld %attr(755, root, root) %{_sbindir}/mysqld
%attr(755, root, root) %{_sbindir}/mysqlmanager
%attr(755, root, root) %{_sbindir}/rcmysql %attr(755, root, root) %{_sbindir}/rcmysql
%attr(644, root, root) %{_libdir}/mysql/mysqld.sym %attr(644, root, root) %{_libdir}/mysql/mysqld.sym
......
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