Wednesday, 19 February 2014

Executing command on remote machine

use Net::SSH::Perl;
  open("FILE","server_list");
   while($line=<FILE>)
{
    chomp $line;
    $host="$line.systems.com";
    my $ssh = Net::SSH::Perl->new($host);
    $ssh->login(username, password);
    my($stdout, $stderr, $exit) = $ssh->cmd('uname -a');
    print $stdout."\n";
}


No comments:

Post a Comment