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

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;

Replies are listed 'Best First'.
Re: (9) Net::Telnet time outs
by Rex(Wrecks) (Curate) on Aug 15, 2002 at 05:10 UTC
    "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!