cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1316
Views
10
Helpful
11
Replies

Run Redirect command in background

ivances
Level 1
Level 1

I am developing a script that performs a WA to avoid the loss of the configuration in the cEdge when I upgrade the IOS on SD-WAN.
The script performs the following actions:

cEdge#del /force bootflash:sdwan/ios.cli
cEdge#del /force bootflash:sdwan/sdwan.cli
cEdge#show running-config | redirect bootflash:sdwan/ios.cli

cEdge#show sdwan running-config | redirect bootflash:sdwan/sdwan.cli

cEdge#

The problem comes when executing the command "show sdwan running-config | redirect bootflash:sdwan/sdwan.cli", since its execution takes about 1 minute.

The script is written in Visual Basic, and performs the following actions:
- Send the command "show sdwan running-config | redirect bootflash:sdwan/sdwan.cli".
- Wait for the "cEdge#" dialog to appear again.
- Continue its execution.

Is there any way to use this command in background and not wait for it to finish to show the "cEdge#" dialog again?
To explain myself better, I need the command to be used, the "cEdge#" dialog to appear immediately to continue the script and the previously executed command to continue running in the background while the script continues.

Per example, on Linux, the command would be:

#COMMAND &

[1] 25177 

#

 

 

11 Replies 11

Hello,

 

you probably need some sort of 'Hidden' attribute, or a timer property. Can you post the full VB script you have ?

Hi Georg,

Thank you for your time and quick response!

To summarize, and removing bits of code:

- I open an Excel file with the management IPs and I use it to SSH into the cEdges:

 

Set xlsApp = CreateObject("excel.application")

Set xlsWkb = xlsApp.Workbooks.Open("[ROUTE TO EXCEL]")

Set xlsWs = xlsWkb.Worksheets(1)

 

IPGESTION = xlsWs.Cells(FilaExcel, 4).Value

.Send "ssh " & IPGESTION & VbCr

 

- When inside cEdge, It uses the following commands to force the deletion of existing backup configurations and generate new backups:

 

.Send "del /force bootflash:sdwan/ios.cli" & VbCr
.WaitForString "#"
.Send "del /force bootflash:sdwan/sdwan.cli" & VbCr
.WaitForString "#"
.Send "show running-config | redirect bootflash:sdwan/ios.cli" & VbCr
.WaitForString "#"
.Send "show sdwan running-config | redirect bootflash:sdwan/sdwan.cli" & VbCr

-------------------------This is the time when it takes a long time to perform the redirect.-------------------------
.WaitForString "#"

 

- After executing that code, exit the cEdge and type "OK" in the row corresponding to that cEdge in Excel to verify that the configuration has been saved:

 

.Send vbCr
.WaitForString "#"
.Send "exit" & VbCr

 

xlsWs.Cells(FilaExcel, 5).Value = "OK"

 

Just imagine having to use this script on 12,000 cEdges and wait 1 week for the script to finish...

 

Than you so much for your help!!!!

Hello,

 

I see. Thanks for posting the script. With 12,000 devices, this will take forever indeed...

 

I'll see if I can come up with something...

Thank you Georg, I am working on this too, if I find the solution, I will share it.

How about, just don't use the last "WaitForString"?  Perhaps router will take buffered type-ahead of the last exit too.  If so, send "exit" and terminate connection.

Hello Joseph,

 

Thank you for your help.

I tried, by the behaviour is the same, the CLI is blocked until the redirect ends.

Interesting, as I recall (?) IOS did usually allow type ahead (at least to a small extent - assume there a small buffer involved).

When you say the CLI block, you mean you script cannot conclude even without the wait for, correct?

Exactly.

If you try to write "exit" on the cEdge while the command is reditecting the sh sdwan run, u have to wait for the redirect to finish.

By the way, I tested with the shell terminal and the behaviour is the same:

 

cEdge#del /force bootflash:sdwan/sdwan.cli
cEdge#show sdwan running-config > bootflash:sdwan/sdwan.cli

-----------------1 minute wait-----------------

cEdge#

Well, the only other thing that jumps to mind is piping the command(s) you want to execute either from a server or from the platform's flash, and not waiting for the results.

Yes, I am trying to do it now via TCL but i am new with TCL scripting.

The behaviour, as expected, is the same:

 

cEdge#tclsh bootflash:/redirectsdwan.tcl

----------1 minute wait----------

cEdge#

 

The script is simple, it just has "show sdwan running-config | redirect bootflash:sdwan/sdwan.cli", as I am still investigating how to script on TCL.

TCL on the platform, itself?  If so, you likely can get additional assistance if you post a fresh query for that.