Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: (7) Net::Telnet time outs

by Rex(Wrecks) (Curate)
on Aug 14, 2002 at 15:52 UTC ( [id://190129]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: (5) Net::Telnet time outs
in thread Net::Telnet time outs

Ok, now for the obvious, is backup.pl in your path? Try running a different (very simple "hello world" style) perl script that is in the exact same place as backup.pl with the same permissions. This is seeming to be very strange. Also remove the waitfors, the cmd method will wait for timeout or prompt match, whichever is first.

Make sure you are running with use strict ; and -w for as much info as possible.

Also is there anything in @lines? Does the command return anything? (Although that is not likely whit the info in the dump log.).

There must be something we are missing, with the info we have given you this should work just fine.

"Nothing is sure but death and taxes" I say combine the two and its death to all taxes!

Replies are listed 'Best First'.
Re: Re: (7) Net::Telnet time outs
by mnlight (Scribe) on Aug 14, 2002 at 16:43 UTC
    In the script I open up two Telnet sessions. The first one is to dump the database. The second one is to dump the tran log both commands use the same backup.pl script the only difference is that to dump the tran you pass it the "Backup.Type=tran" parameter. Dumping the database works fine but when you backup the database the script returns an information message "Dumping database $dbname". for this session I have a waitfor(Dumping database) that seems to make it wait long enough to finish the command. When you dump the tran it returns nothing so I am not able to find a match on that command that I can waitfor. here is the code
    This part works fine. my $th = new Net::Telnet (input_log => "$dir/$log", dump_log => (*STDOUT), Host => "$server", Prompt => '/sybase?/'); $th->login("user", "$unixpass"); my @lines = $th->cmd("backup_sybase.pl Server.Name=$dbsrvr Backup.Data +base=$cltdb"); $th->waitfor('/Dumping database/'); print @lines; $th->waitfor('/sybase?/'); print @lines; print "******DUMPING $cltdb TRANSACTION******\n"; This part does not work. my $th = new Net::Telnet (input_log => "$dir/$log", dump_log => (*STDOUT), Host => "$server", Prompt => '/sybase?/'); $th->login("user", "$unixpass"); my @lines = $th->cmd(String => ("backup.pl Server.Name=$dbsrvr Backup.Database=$cltdb Backup.Type=tran"), Timeout + => 600); $th->waitfor('/sybase?/'); print @lines;
      "both commands use the same backup.pl script the only difference is that to dump the tran you pass it the "Backup.Type=tran" parameter."

      Yet you use backup_sybase.pl in the first "working" part of the code, and just backup.pl in the second "broken" part of the code. Could the problem be this simple?

      Also, you don't need to create a second object for the second part, just reuse the first one. And if you do create the second one, be sure to use the close method first, and it is probably best to use an different var name that $th for the second one, especially for debugging.

      "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
Re: Re: (7) Net::Telnet time outs
by mnlight (Scribe) on Aug 14, 2002 at 23:04 UTC
    if I add waitfor('/NULL/') it will timeout long enough to run the command. but it then fails because of a bad match. I found this info in the telnet doc. "In an array context, just the output generated by the command is returned, one line per element. In other words, all the characters in between the echoed back command string and the prompt are returned. If the command happens to return no output, an array containing one element, the null string is returned. This is so the array will indicate true in a boolean context" How do I match this null string?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://190129]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-19 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found