cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1738
Views
0
Helpful
3
Replies

Script to Shut and Unshut a Port on a Periodic Manner

renato.berana
Level 1
Level 1

Hi Guys, Our client requires that a certain port on a 3560 switch be shutdown at 7pm and unshut at 7am. What is the best solution for their requirements, is an EEM script capable of doing the trick? Please help.

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

EEM is certainly a possibility. What version of IOS is running on this switch?

The switch is running ip-services 12.2(50)SE1. How to do that using EEM?

These two applet policies should do what you want:

event manager applet shut-port

event timer cron cron-entry "0 19 * * *"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "int $port_to_shut"

action 4.0 cli command "shut"

action 5.0 cli command "end"

action 6.0 syslog msg "Successfully shutdown $port_to_shut"

event manager applet no-shut-port

event timer cron cron-entry "0 7 * * *"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "int $port_to_shut"

action 4.0 cli command "no shut"

action 5.0 cli command "end"

action 6.0 syslog msg "Successfully brought $port_to_shut back up"

Then, just set the port_to_shut environment variable to the value of the port you want to shutdown. For example:

event manager environment port_to_shut Fa0/5

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: