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 see my 
sample code below.

Looks like after rebooting the remote Windows Host, the SSH Connection Handle 
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. 

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


use Net::SSH::Perl;

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

my ($output, $err, $exitStatus);
($output, $err, $exitStatus) = $connectionHandle->cmd("ipconfig & hostname");
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) = $connectionHandle->cmd("shutdown /r /f /t 00");
my $time=2 * 60;
print "Sleeping for $time\n";
sleep($time);

if (<CHECK fo CONNECT PRESENT or NOT> == <NOT CONNECTED>){
                   $connectionHandle = Net::SSH::Perl->new("10.180.12.167");
}
($output, $err, $exitStatus) = $connectionHandle->cmd("ipconfig & hostname");
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  


      Now, send attachments up to 25MB with Yahoo! India Mail. Learn how. 
http://in.overview.mail.yahoo.com/photos
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to