I looking to find a way to do a shut and no shut until the tracking change state. For spoke router using a DHCP connection to the Internet. When there is a problem with the connection, the modem will give a private ip adresse and by just doing a shut and then a no shut it fix the issue but I would like to do it automaticaly. I have already tried with a event manager applet but when the tracking change state it will execute only the commands only once but I would like it to do it every 10 minutes until the tracking change state again. Maybe with tcl script but don't realy know where to start.
You can do what you want using three applets (two top-level applets, and one nested applet).
event manager environment quote "
event manager applet track-down
event track 1 state down
action 001 cli command "enable"
action 002 cli command "config t"
action 003 cli command "event manager applet track-timer"
action 004 cli command "event timer watchdog time 180 name track_timer"
action 005 cli command "action 1.0 cli command enable"
action 006 cli command "action 2.0 cli command $quote config t$quote"
action 007 cli command "action 3.0 cli command $quote interface Fa0/0$quote"
action 008 cli command "action 4.0 cli command shut"
action 009 cli command "action 5.0 cli command $quote no shut$quote"
action 010 cli command "action 6.0 cli command end"
event manager applet track-up
event track 1 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet track-timer"
action 4.0 cli command "end"
The above config will periodically shut/no shut interface Fa0/0 every three minutes until the tracked object comes back up.