- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- perl Net::Telnet problem
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
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
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
05-15-2002 05:28 AM
05-15-2002 05:28 AM
I have to be over looking something but for the life of me I don't know what it is. Here is the code:
my ($block, $filename, $host, $hostname, $k_per_sec, $line, $num_read,
$passwd, $prevblock, $prompt, $size_bsd, $size_sysv, $start_time,
$total_time, $username) ;
$hostname = "piglet";
$username = "blah";
$passwd = "blah1";
$filename = "topfile";
use Net::Telnet ();
$host = new Net::Telnet ( Timeout => 10,
Prompt => '/[\:$%#>] $/'),
$host->open($hostname);
$host->login($username, $passwd) ;
At this point the error message is:
"timed out waiting for command prompt at filename line 22 "
The code for the prompt should cover any prompt but I am using the "$" intentionally.
Any ideas?
Gerald
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2002 05:40 AM
05-15-2002 05:40 AM
Re: perl Net::Telnet problem
Is this a TYPO??
$host = new Net::Telnet ( Timeout => 10,
Prompt => '/[\:$%#>] $/'),
because it should end in a ";"
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2002 05:45 AM
05-15-2002 05:45 AM
Re: perl Net::Telnet problem
from the perl cookbook from O'reilly.
I changed the "," to a ";" and I get the same timeout.
Gerald
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2002 06:09 AM
05-15-2002 06:09 AM
Re: perl Net::Telnet problem
Looks like your prompt is the problem. The backslash should be the other side of the :, i.e.
Prompt => '/[:\$%#>] $/');
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2002 06:49 AM
05-15-2002 06:49 AM
Re: perl Net::Telnet problem
Nice try but that isn't it. I actually added that to the prompt code I found in the Perl Cookbook.
I moved it and same error. I removed it and same error.
Thanks!
Gerald
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2002 07:04 AM
05-15-2002 07:04 AM
SolutionOK - if you telnet to piglet, what is the login prompt? Here's what works for me, first the telnet output, then the first part of the script - as you can see , the : at the login prompt matches, and I get the ls /tmp output with no problems:
ln4p2714-2 # telnet ln13p128
Trying...
Connected to ln13p128.
Escape character is '^]'.
Local flow control on
Telnet TERMINAL-SPEED option ON
login:
==========================================
#!/opt/perl5/bin/perl
my ($block, $filename, $host, $hostname, $k_per_sec, $line, $num_read,
$passwd, $prevblock, $prompt, $size_bsd, $size_sysv, $start_time,
$total_time, $username) ;
$hostname = "ln13p128";
$username = "wakefir";
$passwd = "mypasswd";
$filename = "topfile";
use Net::Telnet ();
$host = new Net::Telnet ( Timeout => 10,
Prompt => '/[:\$%#>] $/');
$host->open($hostname);
$host->login($username, $passwd) ;
print $host->cmd("ls /tmp"),"\n";
========================================
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2002 07:20 AM
05-15-2002 07:20 AM
Re: perl Net::Telnet problem
I have been beating my head against my desk on this since lunch yesterday. I am relatively new to perl and am simply trying to find perl solutions for my old scripts that used remsh and rcp as these are going away in our production environment. This answer just solved about 40% of my rewrites.
Gerald
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2002 07:42 AM
05-15-2002 07:42 AM
Re: perl Net::Telnet problem
Use the "Dump_Log", "Input_log", and "Output_log" options (note the capital L in Dump_Log, I don't know why they used that inconsistently either) and check where the timeout happens (first browse the dump_log output.
Here is something I tried to get around the question:
use Net::Telnet;
my $host = Net::Telnet->new (
Timeout => 10,
Host => $hostname,
Dump_Log => "xx.dmp",
Input_log => "xx.inp",
Output_log => "xx.out",
Prompt => '/xterm..../'); # My tcsh asks for Term and shows xterm as default with 5 trailing backspaces
$host->login ($username, $passwd);
$host->prompt ('/\s>\s*$/');
$host->cmd ("dumb");
print $host->cmd ("ls /tmp"), "\n";