adding --passwordfile option

This commit is contained in:
Jean-Marie RENOUARD 2015-06-15 15:23:05 +02:00
parent 50d7718c07
commit 7d51d2f69e

View file

@ -1,5 +1,5 @@
#!/usr/bin/perl -w
# mysqltuner.pl - Version 1.4.1
# mysqltuner.pl - Version 1.4.2
# High Performance MySQL Tuning Script
# Copyright (C) 2006-2014 Major Hayden - major@mhtx.net
#
@ -42,7 +42,7 @@ use Getopt::Long;
use File::Basename;
use Cwd 'abs_path';
# Set up a few variables for use in the script
my $tunerversion = "1.4.1";
my $tunerversion = "1.4.2";
my (@adjvars, @generalrec);
# Set defaults
@ -61,6 +61,7 @@ my %opt = (
"skipsize" => 0,
"checkversion" => 0,
"buffers" => 0,
"passwordfile" => 0,
);
# Gather the options from the command line
@ -82,6 +83,7 @@ GetOptions(\%opt,
'mysqlcmd=s',
'help',
'buffers',
'passwordfile=s',
);
if (defined $opt{'help'} && $opt{'help'} == 1) { usage(); }
@ -114,6 +116,7 @@ sub usage {
" --checkversion Check for updates to MySQLTuner (default: don't check)\n".
" --forcemem <size> Amount of RAM installed in megabytes\n".
" --forceswap <size> Amount of swap memory configured in megabytes\n".
" --passwordfile <path>Path to a password file list(one password by line)\n".
"\n".
" Output Options:\n".
" --nogood Remove OK responses\n".
@ -126,7 +129,7 @@ sub usage {
}
my $devnull = File::Spec->devnull();
my $basic_password_files=abs_path(dirname(__FILE__))."/basic_passwords.txt";
my $basic_password_files=($opt{passwordfile} eq "0")? abs_path(dirname(__FILE__))."/basic_passwords.txt" : abs_path($opt{passwordfile}) ;
# Setting up the colors for the print styles
my $good = ($opt{nocolor} == 0)? "[\e[0;32mOK\e[0m]" : "[OK]" ;