Header Only - DO NOT REMOVE - Extreme Networks

XMC TCL scripting, how to wait xx minutes between CLI commands?


Userlevel 1
Hi,

As our Palo Alto firewall device has no scheduled update feature, I want to use XMC scripting for this purpose.

# request system software install version
# request restart system

These are the commands. So how can I tell XMC TCL engine to wait 30 minutes between these two commands?

Regards,
Rahman

23 replies

Userlevel 5
Hello Rahman,

never used but there is a special "sleep" command in XMC.
Open your onlinehelp of XMC and search for "How to create scrips" for more details.
On this page look for "sleep"

Have fun.

Best regards
Stephan
Userlevel 5
SH wrote:

Hello Rahman,

never used but there is a special "sleep" command in XMC.
Open your onlinehelp of XMC and search for "How to create scrips" for more details.
On this page look for "sleep"

Have fun.

Best regards
Stephan

Hello Rahman,
if the "sleep" command isn't working within an TCL script you can use the following TLC build in command:

after [/code]
when is the time your program waits in milliseconds.

Best regards
Stephan
Userlevel 1
SH wrote:

Hello Rahman,

never used but there is a special "sleep" command in XMC.
Open your onlinehelp of XMC and search for "How to create scrips" for more details.
On this page look for "sleep"

Have fun.

Best regards
Stephan

Hello Stephan,

Yes, I tried and "sleep xxx" works. But my script is not working.

#@MetaDataStart
#############################################################################################
# Define your user parameters in this section. For reference, see bundled scripts.
#############################################################################################

#@VariableFieldLabel "Version"
set var version 8.x.x
#@MetaDataEnd

# Enter all CLI commands from here
CLI request system software install version $version
CLI y
sleep 45
CLI show system info

Here is what I get when I run the script:

EMC User: rduran
EMC User Domain: artvin.edu.tr
CLI Login: admin
ACU-PA-3050-1 10.100.2.100 10/05/2018 01:43:04 PM at 01:43:04 PM
Error: session exceeded timeout: 30 secs
Error: session exceeded timeout: 30 secs
ACU-PA-3050-1 #sleep 45
Error: session exceeded timeout: 30 secs

If I don't use "CLI" keyword I get this error:

javax.script.ScriptException:
*** Script Error ***
nul

So how can I run those to commands against PANOS ssh CLI?

Regards,

Rahman 
Userlevel 3
The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.
Userlevel 1
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

But the first command of the script is "CLI request system software install version $version" and it is not run. For testing I deleted the "sleep" line and the result is same:

EMC User: rduran
EMC User Domain: artvin.edu.tr
CLI Login: admin
ACU-PA-3050-1 10.100.2.100 10/05/2018 02:11:20 PM at 02:11:20 PM
Error: session exceeded timeout: 30 secs
Error: session exceeded timeout: 30 secs
Error: session exceeded timeout: 30 secs

Regards,
Rahman
Userlevel 3
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

How long does it take to execute this command when you try to do it manually? Longer than 30 seconds?
Userlevel 1
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

No it runs instantly. First command ask for "Yes/No". After I press "y" it just prints the PANOS job id and returns to console immediately.
Userlevel 5
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello Rahman,

is this timer long enough?

Userlevel 3
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

maybe the script executes the required "y" too fast? can you have it sleep 3 seconds between your two CLI commands (just before you execute CLI y)... just a wild guess..
Userlevel 1
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

@SH, yes I set it 3600 secs.
Userlevel 1
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Kurt, I will try what you suggest but, shouldn't I see the all CLI output, "Yes/no" question?
Userlevel 3
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

My idea was to try something like this:

CLI request system software install version $version
sleep 3

CLI y
sleep 45

CLI show system info
Userlevel 1
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

No luck:

EMC User: rduran
EMC User Domain: artvin.edu.tr
CLI Login: admin
ACU-PA-3050-1 10.100.2.100 10/05/2018 02:43:22 PM at 02:43:22 PM
Error: session exceeded timeout: 30 secs
ACU-PA-3050-1 #sleep 10
Error: session exceeded timeout: 30 secs
Error: session exceeded timeout: 30 secs

What I mean is, after XMC scripting engine login to device, will it show all command outputs in "Results" section of "XMC script run" page? Because when I login via putty, I see two information lines:

Using username "admin".
Using keyboard-interactive authentication.
Password:
Last login: Fri Oct 5 14:43:24 2018 from 192.168.10.199

Number of failed attempts since last successful login: 0

admin@ACU-PA-3050-1>

But I don't see this in "results" section of XMC.
Userlevel 5
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello Rahman,

have a look to these article:

https://gtacknowledge.extremenetworks.com/articles/Solution/Running-an-XMC-Script-on-8-1-4-40-takes-...

Look's like your error message.

Best regards
Stephan
Userlevel 1
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello Stephan,

It seems the link in GTAC KB is protected. I can not download it.

Regards,

Rahman
Userlevel 5
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello,

maybe Kurt has access?

Or you can open a case with reference to this GTAC article.

Best regards
Stephan
Userlevel 3
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

I also don't have access - I just applied to get access - once I got it, I will provide you with the file. Can you send me an email: kurt [dot] semba [@] extremenetworks [dot] com
Userlevel 5
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello Rahman,

did the KB article help?

Best regards
Stephan
Userlevel 1
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello Stephan, No, I could not access the file on the kb, Kurt also did not provide the file yet. Regards, Rahman
Userlevel 6
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Sorry for the delay.

Try this link:

https://extremenetworks2com.sharepoint.com/:u:/s/kcs/EZ97BhsnkDFBlbR8rECVkdABpd9JjlAHRzbj0-4okPJ7rg
Userlevel 6
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Sorry for the delay.

Try this link:

https://extremenetworks2com.sharepoint.com/:u:/s/kcs/EZ97BhsnkDFBlbR8rECVkdABpd9JjlAHRzbj0-4okPJ7rg
Userlevel 5
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello Ryan,

links works fine.
Userlevel 5
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello Ryan,

links works fine.
Userlevel 1
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello Ryan,

I loaded the file but it did not solve the issue. Our new support contract is on the way. When it is active I will open a bunch of cases with GTAC.
Userlevel 1
Kurt Semba wrote:

The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.

Hello Ryan,

I loaded the file but it did not solve the issue. Our new support contract is on the way. When it is active I will open a bunch of cases with GTAC.

Reply