in reply to Re: NET::OpenSSH to execute multiple commands
in thread NET::OpenSSH to execute multiple commands
Thanks for the reply. I'm still having problems with it. I will paste my code snippet to get some feedback if possible
$user="myname"; $pass="mypass"; @ip = split( /\./, $IPNumber ); if ( $ip[0] == 110 ) { $rtrIP = "10.10.10.1"; } else if ( $ip[0] == 120 ) { $rtrIP = "10.20.20.1"; } else { die( "not in my range" ); } ($Core) = &SSHconnect( $rtrIP, $user, $pass ); @Output = $Core->capture( "show ip route $IPNumber" ) or die( " command failed: " . ($! >> 8) ); ($Core2) = &SSHconnect( $rtrIP, $user, $pass ); @Output2 = $Core2->capture( "show run | include hostname" ) or die( " command failed: " . ($! >> 8) ); foreach $Line ( @Output || @Output2 ) { if ( $Line =~ m/^Routing entry for / ) { @Data = split( ' ', $Line ); $Subnet = $Data[ 3 ] ; last ; } if ( $Line =~ m/^hostname / ) { @Data2 = split( ' ', $Line ); $Rname = $Data[ 2 ] ; last ; } } @network = split( /\./, $Subnet ); $rIP = join( '.', $network[0], $network[1], $network[2], '1' );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: NET::OpenSSH to execute multiple commands
by toolic (Bishop) on Aug 24, 2012 at 20:27 UTC | |
by hmb104 (Sexton) on Aug 24, 2012 at 21:55 UTC | |
|
Re^3: NET::OpenSSH to execute multiple commands
by aitap (Curate) on Aug 24, 2012 at 20:29 UTC | |
by hmb104 (Sexton) on Aug 24, 2012 at 21:50 UTC | |
by Kenosis (Priest) on Aug 25, 2012 at 02:32 UTC | |
|
Re^3: NET::OpenSSH to execute multiple commands
by hmb104 (Sexton) on Aug 24, 2012 at 20:19 UTC |