in reply to Re: Multiple Device Logon execute the same command
in thread Multiple Device Logon execute the same command
#!/usr/bin/perl -w use strict; use warnings; main (@ARGV); sub main { # This array contains the list of hosts my @host = ("ajsfdevbcs11", "ajsfdevbcs12"); my $i; for($i = 0; $host[$i]; $i++) { # message ($host[$i]); } # This is the logon ID my $user = "tsasa067"; # message ($user); # This is the logon password my $security = 'F@therL0^eMe'; # message ($security); # These are the commands I would like to run my @cmd = ("switchname", "chassisshow", "switchstatusshow", "switc +hshow"); my $j; for($j = 0; $cmd[$j]; $j++) { # message ($cmd[$j]); } my @results = 'plink -ssh -pw = $security -l = $user $host'; print $results[0]; } sub message { my $m = shift or return; print ("$m\n"); } sub error { my $e = shift || 'unkown error'; print("$0: $e\n"); exit 0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Multiple Device Logon execute the same command
by vinoth.ree (Monsignor) on Mar 27, 2015 at 14:27 UTC | |
by PerlCramps (Novice) on Apr 03, 2015 at 12:14 UTC | |
by dasgar (Priest) on Apr 03, 2015 at 18:12 UTC |