Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

TCL script with timer for manipulating interfaces

Hello

I find some TCL script for shutdown interfaces,

But now , i want to shutdown interfaces at an exact time.

For examples at 07:00 pm the F0/2 shutdown and the morning at 08:00 am the interface become up.

My problem is that I can not isolated from the time from the "show clock"

Do you have any information on that?

Is it possible tou execute this ?

Thank you

Romain F.

Ps: Sorry if my English is bad

2 REPLIES
New Member

TCL script with timer for manipulating interfaces

Hy everyone ,

If you are intersted , i find an answer to my question .

    set time [clock format [clock seconds] -format "%H%M%S"];

    while { $time <= 165530} {

            puts "$time";

            set time [clock format [clock seconds] -format "%H%M%S"];

        }

    set ifnum f0/15;

    puts ifnum

    puts "shut down interface $ifnum" ;

    set mode "interface $ifnum" ;

    set cmd "shutdown";

    ios_config $mode $cmd ;

    set time [clock format [clock seconds] -format "%H%M%S"];

    while { $time <= 165630} {

            puts "$time";

            set time [clock format [clock seconds] -format "%H%M%S"];

        }

    set ifnum f0/15;

    puts ifnum

    puts "shut down interface $ifnum" ;

    set mode "interface $ifnum" ;

    set cmd "no shutdown";

    ios_config $mode $cmd ;

It works like this :

At 16h55m30s , it shut down the interface

And at 16h56m30, it no shut down the interface

Have a nice day !

New Member

TCL script with timer for manipulating interfaces

Hey

My script finaly work, there is the finaly version

set time [clock format [clock seconds] -format "%H%M%S"]

set date [clock format [clock seconds] -format "%D"]

while { $date <= "03/02/2014" } {

    while { $time <= "104230" } {

        set time [clock format [clock seconds] -format "%H%M%S"]

        set date [clock format [clock seconds] -format "%D"]

        }

    set ifnum f0/15

    puts "shut down interface $ifnum"

    set mode "interface $ifnum"

    set cmd "shutdown"

    ios_config $mode $cmd

    set date  [clock format [clock seconds] -format "%D"]

    set time [clock format [clock seconds] -format "%H%M%S"]

    while { $time <= "104330" } {   

        set time [clock format [clock seconds] -format "%H%M%S"]

        set date [clock format [clock seconds] -format "%D"]

        }

    set ifnum f0/15

    puts "no shut down interface $ifnum"

    set mode "interface $ifnum"

    set cmd "no shutdown"

    ios_config $mode $cmd

    set date [clock format [clock seconds] -format "%D"]

    set time [clock format [clock seconds] -format "%H%M%S"]

    set date_today [clock format [clock seconds] -format "%D"]

    while { $date <= $date_today } {   

        set time [clock format [clock seconds] -format "%H%M%S"]

        set date [clock format [clock seconds] -format "%D"]

        }

}

Bold characters can be change.

Have a nice day!

Romain F.

234
Views
0
Helpful
2
Replies
CreatePlease to create content