I am having a bit of a problem with a script that I setup. A little background:
The function of the script is to read from a list of servers that is in a text file separated by :: , log on to the servers, check to see that mysql is running and report back. The file is configured such that each line has: Servername::Ip address::port number
The problem I am having is that I think perl is trying to concatenate the ip address that I am feeding to the function I have in the code. Can anyone point my in the right direction?
#!/usr/bin/perl
use strict;
use warnings;
open(FH, '<', 'serverlist_test') or error("Cannot open file , ($!)");
while (my $line = <FH>) {
our ($name, $ip, $port) = split(/::/, $line);
my $version = &MySQL_check($ip, $port);
}
close FH;
sub MySQL_check {
my $issue = `ssh -t root@"$_[0]" -p$"_[1]" 'ps axco command | grep -i mysql'`;
print $issue;
if ($issue =~ /mysql/) {
return "Mysql found";
} else {
return "Mysql not found";
}
}
What am I doing wrong?
Thank You.