in reply to Net::Telnet time outs

I would say that your prompt looks funny. Additionally, I would turn up the timeout in your connection info:
my $th = new Net::Telnet (input_log => "$dir/$log", dump_log => (*STDOUT), Host => "$server", Prompt => '/sybase?/', Timeout => 600); ### A timeout of 600 will give you 10 minutes ### to wait for the processes to complete remotely
I had a fair number of problems like this with some telnetting between HP-UX and SUN boxes. The best thing (I found) to look for is the final prompt character, rather than the whole prompt string. The perldocs for Net::Telnet are quite extensive in the newest version (I have it with my perl 5.8.0 build) and they are a great help.

Replies are listed 'Best First'.
Re: Re: Net::Telnet time outs
by mnlight (Scribe) on Aug 13, 2002 at 16:27 UTC
    dump_log output: < 0x00000: 74 65 72 72 61 3a 73 79 62 61 73 65 24 20 terra:sybase$ > 0x00000: 2f 6e 6d 73 2f 73 79 73 74 65 6d 2f 62 69 6e 2f > 0x00010: 73 79 62 61 73 65 2f 62 61 63 6b 75 70 5f 73 79 > 0x00020: 62 61 73 65 2e 70 6c 20 53 65 72 76 65 72 2e 4e backup_sybase.pl Server.Name=LUNA Backup.Database=ES Backup.Type=tran > 0x00030: 61 6d 65 3d 4c 55 4e 41 20 42 61 63 6b 75 70 2e > 0x00040: 44 61 74 61 62 61 73 65 3d 45 53 20 42 61 63 6b > 0x00050: 75 70 2e 54 79 70 65 3d 74 72 61 6e 0d 0a < 0x00000: 2f 6e 6d 73 2f 73 79 73 74 65 6d 2f 62 69 6e 2f < 0x00010: 73 79 62 61 73 65 2f 62 61 63 6b 75 70 5f 73 79 < 0x00020: 62 61 73 65 2e 70 6c 20 53 65 72 76 65 72 2e 4e < 0x00030: 61 6d 65 3d 4c 55 4e 41 20 42 61 63 6b 75 70 2e < 0x00040: 44 61 74 61 62 61 73 65 3d 45 53 20 42 61 63 6b < 0x00050: 75 70 2e 54 79 70 65 3d 74 72 61 6e 0d 0a
      Ahh, ok. Looks like what is happening is that the command actually gets executed, but it takes longer than your timeout to complete.

      I would do this:
      my @lines = $th->cmd(String => ("backup.pl Server.Name=$dbsrvr Backup. +Database=$c", Timeout => 600);
      instaed of my @lines = $th->cmd("backup.pl Server.Name=$dbsrvr Backup.Database=$c
      This will give you a long timeout on that command only.

      Actually seeing the command in the dump_log usually means that you got that far in the script, in this case, the command would never have been executed if the prompt was not matched. If 10 minutes is not enough time for the backup to complete you might want to up the timeout even further.

      "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
        Changed the line to what you suggested and it does not work. if you notice the command is being returned and then it does not waitfor the prompt.
        command being sent
        < 0x00000: 74 65 72 72 61 3a 73 79 62 61 73 65 24 20
        > 0x00000: 2f 6e 6d 73 2f 73 79 73 74 65 6d 2f 62 69 6e 2f
        > 0x00010: 73 79 62 61 73 65 2f 62 61 63 6b 75 70 5f 73 79
        > 0x00020: 62 61 73 65 2e 70 6c 20 53 65 72 76 65 72 2e 4e
        > 0x00030: 61 6d 65 3d 4c 55 4e 41 20 42 61 63 6b 75 70 2e
        > 0x00040: 44 61 74 61 62 61 73 65 3d 43 48 52 49 53 20 42
        > 0x00050: 61 63 6b 75 70 2e 54 79 70 65 3d 74 72 61 6e 0d
        > 0x00060: 0a
        Command being returned
        . < 0x00000: 2f 6e 6d 73 2f 73 79 73 74 65 6d 2f 62 69 6e 2f
        < 0x00010: 73 79 62 61 73 65 2f 62 61 63 6b 75 70 5f 73 79
        < 0x00020: 62 61 73 65 2e 70 6c 20 53 65 72 76 65 72 2e 4e
        < 0x00030: 61 6d 65 3d 4c 55 4e 41 20 42 61 63 6b 75 70 2e
        < 0x00040: 44 61 74 61 62 61 73 65 3d 43 48 52 49 53 20 42
        < 0x00050: 61 63 6b 75 70 2e 54 79 70 65 3d 74 72 61 6e 0d
        < 0x00060:
        0a .