in reply to Re^2: Multiple Device Logon execute the same command
in thread Multiple Device Logon execute the same command
Did you read how to execute command in remote machine?
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.
Ex:
#!/usr/bin/perl use Net::SSH::Perl; my $host = "perlhowto.com"; my $user = "user"; my $password = "password"; #-- set up a new connection my $ssh = Net::SSH::Perl->new($host); #-- authenticate $ssh->login($user, $pass); #-- execute the command my($stdout, $stderr, $exit) = $ssh->cmd("ls -l /home/$user");
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 (or install it if you don't) in order to avoid the slowness problem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Multiple Device Logon execute the same command
by PerlCramps (Novice) on Apr 03, 2015 at 12:14 UTC | |
by dasgar (Priest) on Apr 03, 2015 at 18:12 UTC |