cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5733
Views
5
Helpful
13
Replies

Shutdown Ports Script

breisinger
Level 1
Level 1

I'm using the TCL scripts that Joe Clarke produced in the conversation on shutting down unused ports from Aug 25. It appears like the script is running, and it even produces the susp_ports.dat file, but none of the ports are shut down. I tried it by setting the suspend_ports_days variable to 2 days, but after 4 days no ports have been shut down. Any suggestions?

1 Accepted Solution

Accepted Solutions

Found the problem. This version should fix that problem.

View solution in original post

13 Replies 13

Joe Clarke
Cisco Employee
Cisco Employee

Can you post your exact version of IOS, and the exact script you're using?

I am running C3560-IPSERVICESK9-M, Version 12.2(46)SE.

Post the output of:

show run | inc event manager environment

event manager environment suspend_ports_days 2

event manager environment suspend_ports_config flash:/susp_ports.dat

Okay, you have the policies configured to shutdown ports which have been operationally down for 2 days. But in the config file, these ports have only been down since 9/29 09:50:00. So they would need to still be down on 10/1 at 09:50:00 before they are shutdown.

I had the policy start at 00:00 on 9/26 and it has ran every day at midnight since then. Today when there were still no port shut down, I changed the cron time to 8:50 and ran it again to see if there would be some kind of error message to help troubleshoot. So, the policy has ran 5 times now, with no ports shutdown.

Ugh, I had a typo which I never noticed as I was catching the error. This new version should work for you.

Thanks, I'll give it a try and let you know the result.

The script ran, and there are syslog messages indicating that the ports were shutdown, but they are still enabled.

It looks like there is something in the script that the cli doesn't like. I turned on debug and ran the script, then advanced the clock 2 days and ran it again. The debug shows that it's trying to run "{interface FastEthernet0/1} shut" with the braces and the command is rejected. This is in lines 152 and 165 of the attachment.

Yeah, I have the analysis on my todo list. I should have some time to analyze the code in a little while. I'll post another update.

Found the problem. This version should fix that problem.

This works perfectly!! Thanks for your help.

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: