cancel
Showing results for 
Search instead for 
Did you mean: 

How to load and execute a script to an ERS switch?

How to load and execute a script to an ERS switch?

JackS
New Contributor

Hi all,

I am trying to figure out a way to load a script and store it on an ERS switch (in my case 4800 running 5.12 code) and then execute it.  I have figured out the script blocks but those appear to just be pointers to off board scripts that get uploaded and run when you do the “script run x” command (where x is the table entry number)  You create that entry using the config command “script 1 usb rename.scr” for instance to create a pointer to the script called rename.scr on the usb stick.

I don’t really want to pull the script from a usb or tftp server or whatever… don’t want to have to rely on outboard connectivity if I can put the script on the box ahead of time.  I also was hoping I could load a “revert” script ahead of time so if I wanted to go back I wouldn’t have to manually type a bunch of commands or reboot entirely but unless my error is minor enough that I can still get to the ftp server, it looks like I’m out of luck.

I also don’t want to push a whole config (ascii or binary) to the box to make a few changes.   It appears I can copy a script (copy usb script...) to one of the “blocks” but don’t see a command to execute it once it is there.  I guess that is just for booting the box off of a bull ascii config?? 

So back to question 1… Is there a way to copy a full script to an ERS switch and store it so that I can then execute it without having to have connectivity to an outboard server?

1 ACCEPTED SOLUTION

Ludovico_Steven
Extreme Employee

You can run the scripts manually, with “script run <id>” but the script file is fetched at run time (it is not stored on the switch). The ERS does not really have a proper file system so it is a bit limited in what user can store on it. If you are able to permanently leave a USB stick in the switch, you should be able to achieve what you are looking for.

Here is a test I did..

Little script, as text file “script.cfg” on my TFTP server:

enable
config term
vlan create 666 type port
end

Set it as script 1 on ERS:

ERS4800-1(config)#% script 1 tftp 10.8.12.10 script.cfg
ERS4800-1(config)#% show script 1
Table index: 1
Load script on boot: No
Script source: tftp://10.8.12.10/script.cfg
ERS4800-1(config)#%

Note that the switch does not even attempt to fetch the file.

I want to run the script manually:

ERS4800-1(config)#% script run 1
Downloaded file successfully, executing . . .

ERS4800-1(config)#enable
ERS4800-1(config)#config term
Enter configuration commands, one per line. End with CNTL/Z.
ERS4800-1(config)#vlan create 666 type port
ERS4800-1(config)#end
ERS4800-1#%

Only now the ERS fetches the file and executes it.

Not sure how useful this can be; it simply allows you to store the script filename and TFTP server IP upfront; otherwise the same can be achieved directly like this:

ERS4800-1#% configure network address 10.8.12.10 filename script.cfg
Downloaded file successfully, executing . . .

ERS4800-1#enable
ERS4800-1#config term
Enter configuration commands, one per line. End with CNTL/Z.
ERS4800-1(config)#vlan create 666 type port
% VLANs 666 already exist
ERS4800-1(config)#end
ERS4800-1#%

 

View solution in original post

5 REPLIES 5

Ludovico_Steven
Extreme Employee

You can run the scripts manually, with “script run <id>” but the script file is fetched at run time (it is not stored on the switch). The ERS does not really have a proper file system so it is a bit limited in what user can store on it. If you are able to permanently leave a USB stick in the switch, you should be able to achieve what you are looking for.

Here is a test I did..

Little script, as text file “script.cfg” on my TFTP server:

enable
config term
vlan create 666 type port
end

Set it as script 1 on ERS:

ERS4800-1(config)#% script 1 tftp 10.8.12.10 script.cfg
ERS4800-1(config)#% show script 1
Table index: 1
Load script on boot: No
Script source: tftp://10.8.12.10/script.cfg
ERS4800-1(config)#%

Note that the switch does not even attempt to fetch the file.

I want to run the script manually:

ERS4800-1(config)#% script run 1
Downloaded file successfully, executing . . .

ERS4800-1(config)#enable
ERS4800-1(config)#config term
Enter configuration commands, one per line. End with CNTL/Z.
ERS4800-1(config)#vlan create 666 type port
ERS4800-1(config)#end
ERS4800-1#%

Only now the ERS fetches the file and executes it.

Not sure how useful this can be; it simply allows you to store the script filename and TFTP server IP upfront; otherwise the same can be achieved directly like this:

ERS4800-1#% configure network address 10.8.12.10 filename script.cfg
Downloaded file successfully, executing . . .

ERS4800-1#enable
ERS4800-1#config term
Enter configuration commands, one per line. End with CNTL/Z.
ERS4800-1(config)#vlan create 666 type port
% VLANs 666 already exist
ERS4800-1(config)#end
ERS4800-1#%

 

GTM-P2G8KFN