Is there a way to stack two commands in a single line via the CLI (like dis port then en port)?

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • Answered
  • (Edited)
Wondering if there is a way to stack two commands in a single line of the EXOS CLI?  For example in windows you can issue a "ipconfig /release & ipconfig /renew" in one line and it will execute both commands back to back.  I need to cycle a port than I'm actually connected through so I'd like to do the same with a "disable port x | enable port x" type of command.  Is this possible?  Thanks in advance!
Photo of Eric Burke

Eric Burke

  • 2,428 Points 2k badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of Patrick Voss

Patrick Voss, Employee

  • 11,484 Points 10k badge 2x thumb
Hello Eric,

You can utilize the "restart port" command. That should get the job done.

The other option would be to create a script and run it.
Photo of Daniel B

Daniel B

  • 360 Points 250 badge 2x thumb

Hello Patrick,

is a script in the case of disable the connected port working? I think the script would stop after the disable command for the e.g. uplink port.

regards Daniel.

Photo of Grosjean, Stephane

Grosjean, Stephane, Employee

  • 12,582 Points 10k badge 2x thumb
The script is local to the switch. If running 21 or later, you could achieve the same remotely through jsonrpc.
Photo of Eric Burke

Eric Burke

  • 2,428 Points 2k badge 2x thumb
Thanks Patrick...  Just looking through CLI and found that command!
Photo of Karthik Mohandoss

Karthik Mohandoss, Employee

  • 5,524 Points 5k badge 2x thumb
Eric,

You can also do this.

Create a file via CLI with the extension .xsf and you can run that as script.

vi test.xsf
disable port 1
enable port 1

"to exit press "ESC" and then type !wq "enter"

Once done you can run the script "run script test"

I hope this can also help!