12-09-2022 04:14 AM
Hi,
I want to use EEM code to bounce ports of two switches, but the code I have bounce only the first switch ports.
event manager applet port_bounce authorization bypass
event none sync yes maxrun 240
action 0010 set switch "1"
action 0020 cli command "enable"
action 0030 cli command "config t"
action 0040 while switch le 2
action 0060 set port "1"
action 0070 if $port le "5"
action 0080 cli command "interface Gi$switch/0/$port"
action 0090 cli command "shutdown"
action 0100 wait 5
action 0110 cli command "no shutdown"
action 0120 increment port 1
action 0130 else
action 0135 increment switch 1
action 0140 end
action 0145 end
!
I appreciate any help!
Solved! Go to Solution.
12-11-2022 02:26 PM
Place the "set port 1" outside the while loop. port variable keeps getting set to 1 at each iteration.
12-11-2022 02:26 PM
Place the "set port 1" outside the while loop. port variable keeps getting set to 1 at each iteration.
12-13-2022 05:35 PM
Thank you Dan
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide