- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Perl SSH::Perl Module
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2007 08:26 AM
тАО04-10-2007 08:26 AM
I'm trying to develop a GUI monitor application for my operations using Perl/TK. This app will monitor all our HPUX systems. I'm having a little problem with the Net::SSH
module. The problem is that all commands that I issue with this module writes to STDOUT. but i need it to write to a variable so that i can manipulate the data. I have tried redirecting STDOUT in my script to write to a file, which works ok but then i can't change STDOUT back so I can open up the file and manipulate the date. attached is the script I writtened any help will be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2007 08:35 AM
тАО04-10-2007 08:35 AM
Re: Perl SSH::Perl Module
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new($host);
$ssh->login($user, $pass);
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
hope that answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2007 08:52 AM
тАО04-10-2007 08:52 AM
Re: Perl SSH::Perl Module
Also the Net::SSH::Perl module take to long authenticated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2007 09:38 AM
тАО04-10-2007 09:38 AM
Re: Perl SSH::Perl Module
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2007 12:05 PM
тАО04-10-2007 12:05 PM
Re: Perl SSH::Perl Module
Perl's 'select' should help you. Consider this:
#!/usr/bin/perl
use strict;
use warnings;
my $log = '/tmp/mylog';
open(FH,">",$log) or die "Can't open '$log': $!\n";
print "This goes to your terminal (STDOUT)...\n";
my $oldfh = select(FH);
print "...but this goes to the log file...\n";
select($oldfh); #...back to STDOUT...
print "...and this you see on your terminal, again\n";
1;
The 'select' returns the currently selected output filehandle, and if another filehandle is supplied, it sets that one as the current output default. Thus, a write or a print without a filehandle argument defaults to this filehandle.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-11-2007 12:51 AM
тАО04-11-2007 12:51 AM
SolutionI have to admid to never have used Net::SSH
as I consider it somewhat redundant because it is more or less only a wrapper around the ssh command.
But it has a more palatable interface than doing the forking and piping with standard Perl IPC techniques.
So I just have looked up the POD of Net::SSH
http://search.cpan.org/~ivan/Net-SSH-0.08/SSH.pm
only to discover that it already comes with a
sshopen2() function for pretty straight forward access to STDIN and STDOUT.
Please, see the example in the POD.
If you are also interested in STDERR use sshopen3(), which gives you even handles to three pipes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2007 04:46 AM
тАО04-12-2007 04:46 AM