in reply to Re: Re: Net::Telnet time outs
in thread Net::Telnet time outs

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!

Replies are listed 'Best First'.
Re: Re: Re: Re: Net::Telnet time outs
by mnlight (Scribe) on Aug 13, 2002 at 20:14 UTC
    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 .
      Hmm, not quite, the command "being returned" is simply the "echo" of the command coming back, this happens immediatly after you send it, it's like when you type in a telnet window, for every keystroke you send it sends one back to display in your console. This does NOT mean the command is finished, the command could very well be hanging. How long does the command take to run in a regular telnet window? The fact that the dump log ends there means that nothing is coming back through the telnet connection, not even a prompt, which tells me the command (for whatever reason) is not finished.

      Example: I sent a sleep command to one of my machines this was the output of it and the chain of events:
      #Command I sent my @lines = $th->cmd("sleep 10"); #dump_log output #Matched a prompt < 0x00000: 72 65 78 40 44 72 69 7a 7a 74 3e 20 rex@Dri +zzt> #command is sent > 0x00000: 73 6c 65 65 70 20 31 30 0d 0a sleep 1 +0.. #command is immediatly echoed back < 0x00000: 73 6c 65 65 70 20 31 30 0d 0a sleep 1 +0.. #10 second wait here and then prompt returns < 0x00000: 72 65 78 40 44 72 69 7a 7a 74 3e 20 rex@Dri +zzt>

      Remember that dump_log is both input and output logs!

      "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
        The command will take any where from 1 to 30 seconds to run. I am dumping a sybase database tran log. The command is never executed almost like the command is sent then it exits from the Telnet session it then stops the job. When the command is executed in another window nothing is returned until it completes and goes back to the prompt.