mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
Merge pt-ms-pt-stalk-standard-mysql-options.
This commit is contained in:
@@ -43,7 +43,6 @@ collect_mysqld_instances () {
|
||||
echo "internal::oom_of_$pid $oom" >> "$variables_file"
|
||||
done
|
||||
|
||||
pids="$pids"
|
||||
pids="$(echo $pids | sed -e 's/ /,/g')"
|
||||
ps ww -p "$pids" 2>/dev/null
|
||||
else
|
||||
@@ -201,8 +200,13 @@ get_mysqldump_args () {
|
||||
collect_mysqld_executables () {
|
||||
local mysqld_instances="$1"
|
||||
|
||||
local ps_opt="cmd="
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
ps_opt="command="
|
||||
fi
|
||||
|
||||
for pid in $( grep '/mysqld' "$mysqld_instances" | awk '/^.*[0-9]/{print $1}' ); do
|
||||
ps -o cmd -p $pid | sed -e 's/^\(.*mysqld\) .*/\1/' | grep -v '^CMD$'
|
||||
ps -o $ps_opt -p $pid | sed -e 's/^\(.*mysqld\) .*/\1/'
|
||||
done | sort -u
|
||||
}
|
||||
|
||||
|
68
lib/bash/mysql_options.sh
Normal file
68
lib/bash/mysql_options.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
# This program is copyright 2011 Percona Inc.
|
||||
# Feedback and improvements are welcome.
|
||||
#
|
||||
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation, version 2; OR the Perl Artistic License. On UNIX and similar
|
||||
# systems, you can issue `man perlgpl' or `man perlartistic' to read these
|
||||
# licenses.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
# Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
# ###########################################################################
|
||||
# mysql_options package
|
||||
# ###########################################################################
|
||||
|
||||
# Package: mysql_options
|
||||
# Handle --defaults-file & related options
|
||||
|
||||
set -u
|
||||
|
||||
mysql_options() {
|
||||
local MYSQL_ARGS=""
|
||||
if [ -n "$OPT_DEFAULTS_FILE" ]; then
|
||||
MYSQL_ARGS="--defaults-file=$OPT_DEFAULTS_FILE"
|
||||
fi
|
||||
if [ -n "$OPT_PORT" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --port=$OPT_PORT"
|
||||
fi
|
||||
if [ -n "$OPT_SOCKET" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --socket=$OPT_SOCKET"
|
||||
fi
|
||||
if [ -n "$OPT_HOST" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --host=$OPT_HOST"
|
||||
fi
|
||||
if [ -n "$OPT_USER" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --user=$OPT_USER"
|
||||
fi
|
||||
if [ -n "$OPT_PASSWORD" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --password=$OPT_PASSWORD"
|
||||
fi
|
||||
|
||||
echo $MYSQL_ARGS
|
||||
}
|
||||
|
||||
# This basically makes sure that --defaults-file comes first
|
||||
arrange_mysql_options() {
|
||||
local opts="$1"
|
||||
|
||||
local rearranged=""
|
||||
for opt in $opts; do
|
||||
if [ "$(echo $opt | awk -F= '{print $1}')" = "--defaults-file" ]; then
|
||||
rearranged="$opt $rearranged"
|
||||
else
|
||||
rearranged="$rearranged $opt"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$rearranged"
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# End mysql_options package
|
||||
# ###########################################################################
|
@@ -398,7 +398,7 @@ _parse_command_line() {
|
||||
|
||||
if [ "$next_opt_is_val" ]; then
|
||||
next_opt_is_val=""
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "-") -eq 1 ]; then
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "\-") -eq 1 ]; then
|
||||
option_error "$real_opt requires a $required_arg argument"
|
||||
continue
|
||||
fi
|
||||
@@ -406,7 +406,7 @@ _parse_command_line() {
|
||||
opt_is_ok=1
|
||||
else
|
||||
# If option does not begin with a hyphen (-), it's a filename, etc.
|
||||
if [ $(expr "$opt" : "-") -eq 0 ]; then
|
||||
if [ $(expr "$opt" : "\-") -eq 0 ]; then
|
||||
if [ -z "$ARGV" ]; then
|
||||
ARGV="$opt"
|
||||
else
|
||||
|
@@ -1489,6 +1489,7 @@ report_mysql_summary () {
|
||||
# ########################################################################
|
||||
section "Configuration File"
|
||||
local cnf_file="$(get_var "pt-summary-internal-Config_File_path" "$dir/mysql-variables")"
|
||||
|
||||
if [ -n "${cnf_file}" ]; then
|
||||
name_val "Config File" "${cnf_file}"
|
||||
pretty_print_cnf_file "$dir/mysql-config-file"
|
||||
|
Reference in New Issue
Block a user