Skip to content

Commit

Permalink
Add a --sshuser argument
Browse files Browse the repository at this point in the history
It may be that the user running the command is different from the SSH user
on the server. This argument allows specification of the SSH username.
  • Loading branch information
westnet-paul authored and jfcoz committed Jan 27, 2021
1 parent 312d197 commit 35e0c5b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion postgresqltuner.pl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
my $help=0;
my $work_mem_per_connection_percent=150;
my @Ssh_opts=('BatchMode=yes');
my $ssh_user=undef;
my $ssd=0;
my $nocolor=0;
my $skip_ssh=0;
Expand All @@ -96,6 +97,7 @@
"help" => \$help,
"wmp=i" => \$work_mem_per_connection_percent,
"sshopt=s" => \@Ssh_opts,
"sshuser=s" => \$ssh_user,
"ssd" => \$ssd,
"nocolor" => \$nocolor,
"skip-ssh" => \$skip_ssh,
Expand Down Expand Up @@ -234,7 +236,11 @@ sub usage {
} elsif ($host =~ /^::1$/) {
$os_cmd_prefix='';
} elsif ($host =~ /^[a-zA-Z0-9._-]+$/) {
$os_cmd_prefix="ssh $ssh_opts $host ";
if (defined($ssh_user)) {
$os_cmd_prefix="ssh $ssh_opts $ssh_user\@$host ";
} else {
$os_cmd_prefix="ssh $ssh_opts $host ";
}
} else {
die("Invalid host '$host'");
}
Expand Down

0 comments on commit 35e0c5b

Please sign in to comment.