ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activeperl
activeperl
Help need on Net::SSH::Perl
by VenkataRamaKrishna Boddu other posts by this author
Oct 9 2009 7:24AM messages near this date
Re: Help with unpack | Error on Perl Module File-Find-Rule when run .pl/and create exe
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 un
usable, 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-> n
ew("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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved