Fixed a Solaris awk bug, found a more reliable way to get the home directory, and fixed a syntactical error. (Thanks to Adam Stein)
This commit is contained in:
parent
e425897b41
commit
fff47e9a6f
1 changed files with 9 additions and 9 deletions
|
@ -32,7 +32,7 @@
|
||||||
# Blair Christensen Hans du Plooy
|
# Blair Christensen Hans du Plooy
|
||||||
# Victor Trac Everett Barnes
|
# Victor Trac Everett Barnes
|
||||||
# Tom Krouper Gary Barrueto
|
# Tom Krouper Gary Barrueto
|
||||||
# Simon Greenaway
|
# Simon Greenaway Adam Stein
|
||||||
#
|
#
|
||||||
# Inspired by Matthew Montgomery's tuning-primer.sh script:
|
# Inspired by Matthew Montgomery's tuning-primer.sh script:
|
||||||
# http://forge.mysql.com/projects/view.php?id=44
|
# http://forge.mysql.com/projects/view.php?id=44
|
||||||
|
@ -120,16 +120,16 @@ sub usage {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Setting up the colors for the print styles
|
# Setting up the colors for the print styles
|
||||||
my $good = ($opt{nocolor} == 0)? "[\e[00;32mOK\e[00m]" : "[OK]" ;
|
my $good = ($opt{nocolor} == 0)? "[\e[0;32mOK\e[0m]" : "[OK]" ;
|
||||||
my $bad = ($opt{nocolor} == 0)? "[\e[00;31m!!\e[00m]" : "[!!]" ;
|
my $bad = ($opt{nocolor} == 0)? "[\e[0;31m!!\e[0m]" : "[!!]" ;
|
||||||
my $info = ($opt{nocolor} == 0)? "[\e[00;34m--\e[00m]" : "[--]" ;
|
my $info = ($opt{nocolor} == 0)? "[\e[0;34m--\e[0m]" : "[--]" ;
|
||||||
|
|
||||||
# Functions that handle the print styles
|
# Functions that handle the print styles
|
||||||
sub goodprint { print $good." ".$_[0] unless ($opt{nogood} == 1); }
|
sub goodprint { print $good." ".$_[0] unless ($opt{nogood} == 1); }
|
||||||
sub infoprint { print $info." ".$_[0] unless ($opt{noinfo} == 1); }
|
sub infoprint { print $info." ".$_[0] unless ($opt{noinfo} == 1); }
|
||||||
sub badprint { print $bad." ".$_[0] unless ($opt{nobad} == 1); }
|
sub badprint { print $bad." ".$_[0] unless ($opt{nobad} == 1); }
|
||||||
sub redwrap { return ($opt{nocolor} == 0)? "\e[00;31m".$_[0]."\e[00m" : $_[0] ; }
|
sub redwrap { return ($opt{nocolor} == 0)? "\e[0;31m".$_[0]."\e[0m" : $_[0] ; }
|
||||||
sub greenwrap { return ($opt{nocolor} == 0)? "\e[00;32m".$_[0]."\e[00m" : $_[0] ; }
|
sub greenwrap { return ($opt{nocolor} == 0)? "\e[0;32m".$_[0]."\e[0m" : $_[0] ; }
|
||||||
|
|
||||||
# Calculates the parameter passed in bytes, and then rounds it to one decimal place
|
# Calculates the parameter passed in bytes, and then rounds it to one decimal place
|
||||||
sub hr_bytes {
|
sub hr_bytes {
|
||||||
|
@ -229,7 +229,7 @@ sub os_setup {
|
||||||
$physical_memory = `sysctl -n hw.realmem`;
|
$physical_memory = `sysctl -n hw.realmem`;
|
||||||
$swap_memory = `swapinfo | grep '^/' | awk '{ s+= \$2 } END { print s }'`;
|
$swap_memory = `swapinfo | grep '^/' | awk '{ s+= \$2 } END { print s }'`;
|
||||||
} elsif ($os =~ /SunOS/) {
|
} elsif ($os =~ /SunOS/) {
|
||||||
$physical_memory = `/usr/sbin/prtconf | grep Memory | awk '{print \$3}'` or memerror;
|
$physical_memory = `/usr/sbin/prtconf | grep Memory | cut -f 3 -d ' '` or memerror;
|
||||||
chomp($physical_memory);
|
chomp($physical_memory);
|
||||||
$physical_memory = $physical_memory*1024*1024;
|
$physical_memory = $physical_memory*1024*1024;
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ sub mysql_setup {
|
||||||
# Login went just fine
|
# Login went just fine
|
||||||
$mysqllogin = " $remotestring ";
|
$mysqllogin = " $remotestring ";
|
||||||
# Did this go well because of a .my.cnf file or is there no password set?
|
# Did this go well because of a .my.cnf file or is there no password set?
|
||||||
my $userpath = `ls -d ~ 2>/dev/null`;
|
my $userpath = `printenv HOME`;
|
||||||
if (length($userpath) > 0) {
|
if (length($userpath) > 0) {
|
||||||
chomp($userpath);
|
chomp($userpath);
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ sub mysql_stats {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Key buffer
|
# Key buffer
|
||||||
if (!defined($mycalc{'total_myisam_indexes'}) and $doremote eq 1) {
|
if (!defined($mycalc{'total_myisam_indexes'}) and $doremote == 1) {
|
||||||
push(@generalrec,"Unable to calculate MyISAM indexes on remote MySQL server < 5.0.0");
|
push(@generalrec,"Unable to calculate MyISAM indexes on remote MySQL server < 5.0.0");
|
||||||
} elsif ($mycalc{'total_myisam_indexes'} =~ /^fail$/) {
|
} elsif ($mycalc{'total_myisam_indexes'} =~ /^fail$/) {
|
||||||
badprint "Cannot calculate MyISAM index size - re-run script as root user\n";
|
badprint "Cannot calculate MyISAM index size - re-run script as root user\n";
|
||||||
|
|
Loading…
Reference in a new issue