Script to Shut and Unshut a Port on a Periodic Manner

Unanswered Question
Apr 19th, 2009

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.

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Joe Clarke Sun, 04/19/2009 - 22:40

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

Joe Clarke Mon, 04/20/2009 - 06:36

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

Actions

This Discussion