in reply to Urgent Help For Perl Issues
You can execute commands on remote machines from a Perl script using the Net::SSH::Perl module.
This module allows you to execute a command remotely and receive the STDOUT, STDERR, and exit status of that remote command.
One big advantage of Net::SSH::Perl over other methods is that you can automate the login process, that way you can write fully automated perl scripts, no console interaction is required in order to authenticate in the remote machine.
Example:
Update:#!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; my $host = ""; my $user = ""; my $password = ""; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd("your command");
Execution of Net::SSH::Perl commands can be quite slow if you don't have the Math::BigInt::GMP module; so be sure that you have that module installed in order to avoid the slowness problem. Make sure that in both the Linux servers ssh enabled and server listens on port number 22.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Urgent Help For Perl Issues
by arvindninestars (Initiate) on Mar 15, 2013 at 08:23 UTC | |
by marto (Cardinal) on Mar 15, 2013 at 09:05 UTC | |
by vinoth.ree (Monsignor) on Mar 15, 2013 at 08:36 UTC | |
by Anonymous Monk on Mar 15, 2013 at 09:31 UTC | |
by marto (Cardinal) on Mar 15, 2013 at 09:47 UTC | |
by vinoth.ree (Monsignor) on Mar 15, 2013 at 10:17 UTC | |
by salva (Canon) on Mar 15, 2013 at 10:27 UTC | |
| |
by arvindninestars (Initiate) on Mar 18, 2013 at 07:20 UTC |