Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2009, 10:27 AM
Olive Olive is offline
Registered User
 
Join Date: Jan 2009
Posts: 4
Angry Problem with sleep command in SecureCRT

Hy everybody,

I'm a french user of SecureCRT ans I encouter a problem.

I'm using a script which permit to configure an equipment with CLI.

This script was working fine but it currently doesn't....

It seems that the crt.sleep command isn't interpreted by the CRT which is not waiting the defined time to send next command.

I've reinstall the software, controled all parameters and I'm stopped in my investigations.

Thanks for your help and sorry for the possible mistakes of syntax

Olive
Reply With Quote
  #2  
Old 01-29-2009, 11:27 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Hello Olive,

Which version of SecureCRT are you using (Help / About SecureCRT)?

Can you post a little snippet of code so that we can see where the Crt.Sleep is, and also let us know what you see on the screen (as long as no sensitive information is shown)?
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #3  
Old 01-30-2009, 02:42 AM
Olive Olive is offline
Registered User
 
Join Date: Jan 2009
Posts: 4
Hi,

I'm using 4.1.9 version.

a part of the script is :

crt.screen.send "show software-mngt oswp detail" & VbCr
crt.Sleep 1000
crt.screen.send "show system version" & VbCr
crt.Sleep 1000
crt.screen.send "configure system id "& Dslam_name &""& VbCr
crt.Sleep 1000
crt.screen.send "configure equipment shelf 1/1 yyyyyyyyyy"& VbCr
crt.Sleep 1000
crt.screen.send "configure equipment xxxxxxxxxxx "& VbCr
crt.Sleep 3000



When I'm connected to an equipment and when the commands arrive too quickly, the equipment return a error such like this :

leg:admin>admin>software-mngt>shub>database$ configure system security snmp co
mmunity NETMAN host-address 172.XX.108.X/32 context shub
leg:admin>configure>system>security>snmp>community>NETMAN>host-address>172.XX.108.X/32$ configure system security snmp community public host-address 172.XX.10
8SUPERUSER
^
invalid token



I've have loopbacked my COM port and I can see that any pause is done even if I put 80000 in the crt.sleep command.....

I precise that this problem has occured suddently an without reason.

Thanks for your help.
Reply With Quote
  #4  
Old 01-30-2009, 01:34 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Hello,

Thanks for letting us know the version. Version 4.1.9 is pretty old but the problem with a server receiving data too quickly (and a possible solution) could potentially apply to newer versions as well.

If you were to type all of the same commands interactively at a command prompt do you experience the same errors?

Using crt.Sleep 1000 may not be as useful as Crt.Screen.WaitForString "..." in this instance. What happens if you change the code to something more like the following?
Code:
crt.screen.send "show software-mngt oswp detail" & VbCr
crt.screen.waitforstring "$", 1000
crt.screen.send "show system version" & VbCr
crt.screen.waitforstring "$", 1000
crt.screen.send "configure system id "& Dslam_name &""& VbCr
crt.screen.waitforstring "$", 1000
...
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #5  
Old 01-31-2009, 04:10 PM
Olive Olive is offline
Registered User
 
Join Date: Jan 2009
Posts: 4
Hello

Quote:
Originally Posted by miked
Hello,

If you were to type all of the same commands interactively at a command prompt do you experience the same errors?
No when I take command by command the lines with a cut/paste, I've no problems.
I start to think that the problem comes from the laptop and not frome CRT....

Quote:
Using crt.Sleep 1000 may not be as useful as Crt.Screen.WaitForString "..." in this instance. What happens if you change the code to something more like the following?
Code:
crt.screen.send "show software-mngt oswp detail" & VbCr
crt.screen.waitforstring "$", 1000
crt.screen.send "show system version" & VbCr
crt.screen.waitforstring "$", 1000
crt.screen.send "configure system id "& Dslam_name &""& VbCr
crt.screen.waitforstring "$", 1000
...
I'm going to try this but if I understand good, the CRT will standby for a"$" to continue and my equipment doesn't send this character....

I'll post the results of this modification.
Reply With Quote
  #6  
Old 01-31-2009, 04:35 PM
Olive Olive is offline
Registered User
 
Join Date: Jan 2009
Posts: 4
Hello,

I'm back and I just tried with the waitforsting command.

I must have to remove the timeout parameter in order the script to run normally and not have a "this program....and must close".

After doing this everything was OK so I replace the crt.sleep command in place and ...miracle......all's fine....on a loop on the COM port.

I don't explain what's happen....

I'll test next week with an equipment and post the result
Reply With Quote
  #7  
Old 01-31-2009, 06:59 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Thanks for posting your initial test results. It's a little surprising that Crt.Sleep started working when it didn't work before. It's very surprising to me that using Crt.Screen.WaitForString appears to have caused a crash in SecureCRT 4.1.

I made a mistake when I suggested a timeout of 1000. I meant to suggest a timeout of '1'. In Crt.Sleep time is measured in milliseconds. In Crt.Screen.WaitForString the timeout is measured in seconds. The code I posted was supposed to be an equivalent to your code - so crt.screen.waitforstring "$", 1000 should have been crt.screen.waitforstring "$", 1. Sorry for the confusion.

I don't think that a timeout of should cause SecureCRT 4.1 to stop working, and it works fine for me (only tested with SecureCRT 6.1). However, if you decide to try the WaitForString method again you may want to use a value of 1.

Since Crt.Sleep 1000 is waiting for one second, and it works now, perhaps the only problem was that at times it didn't wait long enough.

When you are able to test with the equipment again, if you run into problems then you might try one of the following to see if the timeout period is the issue:
Crt.Sleep 2000
or
Crt.Screen.WaitForString "$", 2
Using WaitForString has advantages in that it will stop waiting and allow the next line of code to run as soon as "$" is detected, so it won't wait for the full 2 seconds unless it needs to. Plus, you can test the result to make sure you did detect the "$" sign.
Code:
If crt.screen.WaitForString("$", 2) <> True Then
    MsgBox "Did not detect the string we were waiting for..."
End If
Using Crt.Sleep 2000 will always wait for 2 seconds and you can't test the result.
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:57 PM.