CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Telnet in background

 



hem
User

May 19, 2009, 8:32 PM

Post #1 of 4 (814 views)
Telnet in background Can't Post

I have to start a telnet session , issue a command and monitor the telnet session output for any errors

Questions

1. How do I do that
2. Is there a way I can monitor telnet in the background while doing other stuff. (Process i guess any other option??)

Thanks


1arryb
User

May 20, 2009, 7:26 AM

Post #2 of 4 (803 views)
Re: [hem] Telnet in background [In reply to] Can't Post

Hi hem,

You can use Perl::Telnet to intitiate and control a telnet session from Perl. I posted a working telnet script earlier this week, if you want to look at it. Perl::Telnet has some quirks, but it seems to work.

Define "background" and "monitor". You can always open another window and continue working while your script runs. You can also run your script in the background as long as you redirect script I/O to files insead of the console. What exactly do you hope to achieve?

Cheers,

Larry


hem
User

May 20, 2009, 8:06 AM

Post #3 of 4 (800 views)
Re: [1arryb] Telnet in background [In reply to] Can't Post

Sorry for not being clear


where can i find your script . I will look more too

This is what i want to achieve

1. I telnet into a machine and issue a command (i can use Net:Telnet for this)

2. Now I if there is an error on the remote machine i see a "error fatal" on the telnet screen.So my script has to be in a loop looking for error fatal

3. But while its looking for e"error fatal" in step 2 it also has to do a bunch of other operations.Aim is to make sure these other operations dont cause a fatal opeartion

DO do A , do B , do C .While script is doing operation A,B and C keep looking for error on the telnet session

Hope it makes sense

Thanks


1arryb
User

May 20, 2009, 8:22 AM

Post #4 of 4 (798 views)
Re: [hem] Telnet in background [In reply to] Can't Post

Hi hem,

Here's a link to the thread (disclosure: k2pa wrote the original script: I just tweaked it) http://perlguru.com/gforum.cgi?post=38182;#38182.

As pointed out in the thread, I prefer Net::SSH::Perl to Net::Telnet for issuing and monitoring remote commands.

Doing an asynchronous command execution, waiting asynchronously, and getting back the execution status and stdout/stderr of the remote command (as opposed to the ssh call itself) is a tricky business. I've done it in various ways in the past, but I was never completely satisfied with my results. I googled "perl asynchronous remote command" and came up with this thread at perl monks http://www.perlmonks.org/?node_id=692673. This might be a good place to start.

Good luck,

Larry


(This post was edited by 1arryb on May 20, 2009, 1:36 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives