02-13-2014 08:32 AM
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
02-17-2014 12:45 AM
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 !
02-18-2014 05:17 AM
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.
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