Help need on Net::SSH::Perl

Help need on Net::SSH::Perl

am 09.10.2009 16:24:17 von VenkataRamaKrishna Boddu

--===============1777620407==
Content-Type: multipart/alternative; boundary="0-1193112515-1255098257=:44877"

--0-1193112515-1255098257=:44877
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,

This is my first mail to Active Perl community.
My name is Venkata rama Krishna Boddu, working in Hyderabad, India


I'm basically dealing with rebooting of a remote Windows Machine. Please se=
e my sample code below.

Looks like after rebooting the remote Windows Host, the SSH Connection Hand=
le is becaming unusable, even though the Connection Handle Object is still =
present in the Memory.

If there any variable or method in the connection handle, which I can call =
to check, whether connection is reset by the Remote Windows Host or not.=20

I want to place this check in the Code mentioned in RED color below.


use Net::SSH::Perl;

my $connectionHandle =3D Net::SSH::Perl->new("10.180.12.167");
$connectionHandle->login("administrator", "quantum");

my ($output, $err, $exitStatus);
($output, $err, $exitStatus) =3D $connectionHandle->cmd("ipconfig & hostnam=
e");
print "Output: $output\n" if defined($output);
print "Error: $err\n" if defined($err);
print "Exit Status: $exitStatus\n" if defined($exitStatus);

($output, $err, $exitStatus) =3D $connectionHandle->cmd("shutdown /r /f /t =
00");
my $time=3D2 * 60;
print "Sleeping for $time\n";
sleep($time);

if ( == ){
                   $connectionHandle =
=3D Net::SSH::Perl->new("10.180.12.167");
}
($output, $err, $exitStatus) =3D $connectionHandle->cmd("ipconfig & hostnam=
e");
print "Output: $output\n" if defined($output);
print "Error: $err\n" if defined($err);
print "Exit Status: $exitStatus\n" if defined($exitStatus);


Thanks
Venkata Rama Krishna Boddu =0A Now, send attachments up to 25MB=
with Yahoo! India Mail. Learn how. http://in.overview.mail.yahoo.com/photo=
s
--0-1193112515-1255098257=:44877
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

=
top" style=3D"font: inherit;">Hi,

This is my first mail to Active Pe=
rl community.
My name is Venkata rama Krishna Boddu, working in Hyderaba=
d, India


I'm basically dealing with rebooting of a remote Window=
s Machine. Please see my sample code below.

Looks like after rebooti=
ng the remote Windows Host, the SSH Connection Handle is becaming unusable,=
even though the Connection Handle Object is still present in the Memory. r>
If there any variable or method in the connection handle, which I can=
call to check, whether connection is reset by the Remote Windows Host or n=
ot.

I want to place this check in the Code mentioned in =3D"color: rgb(255, 0, 0);">RED color below.


use Net::SSH=
::Perl;

my $connectionHandle =3D Net::SSH::Perl->new("10.180.12.1=
67");
$connectionHandle->login("administrator", "quantum");

my
($output, $err, $exitStatus);
($output, $err, $exitStatus) =3D $connect=
ionHandle->cmd("ipconfig & hostname");
print "Output: $output\n" =
if defined($output);
print "Error: $err\n" if defined($err);
print "E=
xit Status: $exitStatus\n" if defined($exitStatus);

($output, $err, =
$exitStatus) =3D $connectionHandle->cmd("shutdown /r /f /t 00");
my $=
time=3D2 * 60;
print "Sleeping for $time\n";
sleep($time);

if =
(<CHECK fo CONNECT PRESENT or NOT=
> == <NOT CONNECTED>
){
     =
;            &n=
bsp; $connectionHandle =3D Net::SSH::Perl->new("10.180.12.167");
} >($output, $err, $exitStatus) =3D $connectionHandle->cmd("ipconfig &=
hostname");
print "Output: $output\n" if defined($output);
print "Er=
ror: $err\n" if defined($err);
print "Exit Status: $exitStatus\n" if
defined($exitStatus);


Thanks
Venkata Ram=
a Krishna Boddu

=0A
Now, send attachments up to=
25MB with Yahoo! India Mail. axy_2/*http://in.overview.mail.yahoo.com/photos" target=3D"_blank">Learn ho=
w
.
--0-1193112515-1255098257=:44877--

--===============1777620407==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1777620407==--