diff options
author | Igor Babaev <igor@askmonty.org> | 2012-04-11 20:44:52 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-04-11 20:44:52 -0700 |
commit | 9e74665a2d91e299d1b9c5c2695855426aad78eb (patch) | |
tree | 9c865c2e18fcb814ef80e96965debf53a0923e6a /scripts | |
parent | 1c0a89afcc1581187e8ee84abbd445da2bfa45d9 (diff) | |
parent | 85a025f30c5196c22c5b1d7960912fe9b3f0d6c0 (diff) | |
download | mariadb-git-9e74665a2d91e299d1b9c5c2695855426aad78eb.tar.gz |
Merge 5.5 -> 5.5-mwl248.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mysql_install_db.pl.in | 2 | ||||
-rw-r--r-- | scripts/mysql_install_db.sh | 5 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 18 | ||||
-rwxr-xr-x | scripts/mytop.sh | 95 |
4 files changed, 107 insertions, 13 deletions
diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in index 83756d686d2..3fdecc968e1 100644 --- a/scripts/mysql_install_db.pl.in +++ b/scripts/mysql_install_db.pl.in @@ -1,7 +1,7 @@ #!/usr/bin/perl # -*- cperl -*- # -# Copyright (C) 2007 MySQL AB +# Copyright (c) 2007, 2011, Oracle and/or its affiliates. # # 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 diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index f0b09cc3e77..1dd6b787c43 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -1,7 +1,6 @@ #!/bin/sh -# Copyright (c) 2000-2008 MySQL AB, 2009, 2010 Sun Microsystems, Inc. -# Copyright (c) 2009-2011 Monty Program Ab -# Use is subject to license terms. +# Copyright (c) 2000, 2011, Oracle and/or its affiliates. +# Copyright (c) 2009, 2011, Monty Program Ab # # 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 diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 20e5e115687..aaf1936afe1 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -15,6 +15,7 @@ KILL_MYSQLD=1; MYSQLD= niceness=0 +nowatch=0 mysqld_ld_preload= mysqld_ld_library_path= @@ -44,16 +45,18 @@ usage () { cat <<EOF Usage: $0 [OPTIONS] --no-defaults Don't read the system defaults file + --core-file-size=LIMIT Limit core files to the specified size --defaults-file=FILE Use the specified defaults file --defaults-extra-file=FILE Also use defaults from the specified file --ledir=DIRECTORY Look for mysqld in the specified directory --open-files-limit=LIMIT Limit the number of open files - --core-file-size=LIMIT Limit core files to the specified size --timezone=TZ Set the system timezone --malloc-lib=LIB Preload shared library LIB if available --mysqld=FILE Use the specified file as mysqld --mysqld-version=VERSION Use "mysqld-VERSION" as mysqld --nice=NICE Set the scheduling priority of mysqld + --no-auto-restart Exit after starting mysqld + --nowatch Exit after starting mysqld --plugin-dir=DIR Plugins are under DIR or DIR/VERSION, if VERSION is given --skip-kill-mysqld Don't try to kill stray mysqld processes @@ -140,8 +143,16 @@ eval_log_error () { ;; esac - #echo "Running mysqld: [$cmd]" - eval "$cmd" + if test $nowatch -eq 1 + then + # We'd prefer to exec $cmd here, but SELinux needs to be fixed first + #/usr/bin/logger "Running mysqld: $cmd" + eval "$cmd &" + exit 0 + else + #echo "Running mysqld: [$cmd]" + eval "$cmd" + fi } shell_quote_string() { @@ -202,6 +213,7 @@ parse_arguments() { fi ;; --nice=*) niceness="$val" ;; + --nowatch|--no-watch|--no-auto-restart) nowatch=1 ;; --open-files-limit=*) open_files="$val" ;; --open_files_limit=*) open_files="$val" ;; --skip-kill-mysqld*) KILL_MYSQLD=0 ;; diff --git a/scripts/mytop.sh b/scripts/mytop.sh index 7cec85e2136..a36fddf7368 100755 --- a/scripts/mytop.sh +++ b/scripts/mytop.sh @@ -18,8 +18,10 @@ use DBI; use Getopt::Long; use Socket; use List::Util qw(min max); +use File::Basename; $main::VERSION = "1.9a"; +my $path_for_script= dirname($0); $|=1; $0 = 'mytop'; @@ -95,7 +97,8 @@ my %config = ( slow => 10, # slow query time socket => '', sort => 0, # default or reverse sort ("s") - user => 'root' + user => 'root', + fullqueries => 0 ); my %qcache = (); ## The query cache--used for full query info support. @@ -112,6 +115,17 @@ my $CLEAR = $WIN ? '': `clear`; my $RM_RESET = 0; my $RM_NOBLKRD = 3; ## using 4 traps Ctrl-C :-( +# Add options from .my.cnf first + +my $my_print_defaults; +if (!defined($my_print_defaults=my_which("my_print_defaults"))) +{ + print "Warning: Can't find my_print_defaults. Please add it to your PATH!\n"; + exit(1); +} + +unshift @ARGV, split "\n", `$my_print_defaults client mytop`; + ## Read the user's config file, if it exists. my $config = "$ENV{HOME}/.mytop"; @@ -160,7 +174,8 @@ GetOptions( "long_nums!" => \$config{long_nums}, "mode|m=s" => \$config{mode}, "slow=i" => \$config{slow}, - "sort=s" => \$config{sort} + "sort=s" => \$config{sort}, + "fullqueries|L!" => \$config{fullqueries} ); ## User may have put the port with the host. @@ -744,6 +759,25 @@ while (1) { $config{mode} = 'status'; } + + ## L - full queries toggle + + if ($key eq 'L') + { + if ($config{fullqueries}) + { + $config{fullqueries} = 0; + print RED(), "-- full queries OFF --", RESET(); + sleep 1; + } + else + { + $config{fullqueries} = 1; + print RED(), "-- full queries ON --", RESET(); + sleep 1; + } + } + } ReadMode($RM_RESET) unless $config{batchmode}; @@ -1115,7 +1149,13 @@ sub GetData() my $state= $width <= 80 ? 6 : int(min(6+($width-80)/3, 15)); my $free = $width - $used - ($state - 6); my $format= "%9s %8s %15s %9s %6s %5s %6s %${state}s %-.${free}s\n"; - my $format2= "%9d %8.8s %15.15s %9.9s %6d %5.1f %6.6s %${state}.${state}s %-${free}.${free}s\n"; + my $format2; + if ($config{fullqueries}) + { + $format2 = "%9d %8.8s %15.15s %9.9s %6d %5.1f %6.6s %${state}.${state}s %-${free}s\n"; + } else { + $format2 = "%9d %8.8s %15.15s %9.9s %6d %5.1f %6.6s %${state}.${state}s %-${free}.${free}s\n"; + } print BOLD() if ($HAS_COLOR); printf $format, @@ -1244,7 +1284,12 @@ sub GetData() if ($thread->{Info}) { - $smInfo = substr $thread->{Info}, 0, $free; + if ($config{fullqueries}) + { + $smInfo = $thread->{Info}; + } else { + $smInfo = substr $thread->{Info}, 0, $free; + } } # if ($thread->{State}) # { @@ -1690,6 +1735,7 @@ Origional work by Jeremy D. Zawodny <${YELLOW}Jeremy\@Zawodny.com${RESET}> u - show only a specific user V - show variablesi : - enter a command (not yet implemented) + L - show full queries (do not strip to terminal width) Base version from ${GREEN}http://www.mysqlfanboy.com/mytop${RESET} This version comes as part of the ${GREEN}MariaDB${RESET} distribution. @@ -1789,6 +1835,35 @@ sub FindProg($) return $found; } +#### +#### my_which is used, because we can't assume that every system has the +#### which -command. my_which can take only one argument at a time. +#### Return values: requested system command with the first found path, +#### or undefined, if not found. +#### + +sub my_which +{ + my ($command) = @_; + my (@paths, $path); + + return $command if (-f $command && -x $command); + + # Check first if this is a source distribution, then if this binary + # distribution and last in the path + + push @paths, "./extra"; + push @paths, $path_for_script; + push @paths, split(':', $ENV{'PATH'}); + + foreach $path (@paths) + { + $path .= "/$command"; + return $path if (-f $path && -x $path); + } + return undef(); +} + =pod =head1 SYNOPSIS @@ -2056,11 +2131,15 @@ command-line arguments are applied. =head2 Config File Instead of always using bulky command-line parameters, you can also -use a config file in your home directory (C<~/.mytop>). If present, -B<mytop> will read it automatically. It is read I<before> any of your +use a config files for the default value of your options. + +mytop will first read the [client] and [mytop] sections from your +my.cnf files. After that it will read the (C<~/.mytop>) file from your +home directory (if present). These are read I<before> any of your command-line arguments are processed, so your command-line arguments will override directives in the config file. + Here is a sample config file C<~/.mytop> which implements the defaults described above. @@ -2275,6 +2354,10 @@ Many thanks go to these fine folks: =over +=Item Jean Weisbuch + +Added --fullqueries and reading of .my.cnf + =item Sami Ahlroos (sami@avis-net.de) Suggested the idle/noidle stuff. |