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

  • 0
  • 1
  • Question
  • Updated 6 days ago
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
Photo of Rahman Duran

Rahman Duran

  • 802 Points 500 badge 2x thumb

Posted 2 weeks ago

  • 0
  • 1
Photo of SH

SH

  • 4,816 Points 4k badge 2x thumb
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
Photo of SH

SH

  • 4,816 Points 4k badge 2x thumb
Hello Rahman,
if the "sleep" command isn't working within an TCL script you can use the following TLC build in command:

after <ms> <do something>

when <ms> is the time your program waits in milliseconds.

Best regards
Stephan
(Edited)
Photo of Rahman Duran

Rahman Duran

  • 802 Points 500 badge 2x thumb
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 
Photo of Kurt Semba

Kurt Semba, Employee

  • 1,438 Points 1k badge 2x thumb
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.
Photo of Rahman Duran

Rahman Duran

  • 802 Points 500 badge 2x thumb
Hello Stephan,

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

Regards,

Rahman
Photo of SH

SH

  • 4,792 Points 4k badge 2x thumb
Hello,

maybe Kurt has access?

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

Best regards
Stephan
Photo of Kurt Semba

Kurt Semba, Employee

  • 1,438 Points 1k badge 2x thumb
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

Photo of SH

SH

  • 4,792 Points 4k badge 2x thumb
Hello Rahman,

did the KB article help?

Best regards
Stephan
Photo of Rahman Duran

Rahman Duran

  • 802 Points 500 badge 2x thumb
Hello Stephan,

No, I could not access the file on the kb, Kurt also did not provide the file yet.

Regards,
Rahman