Reload a Router from Tcl Script
In his comment, Michal has asked about the ability to execute IOS commands with prompts from Tcl shell. I haven't found a generic solution yet, but you can reload a router from a Tcl script. First you have to define an EEM applet that reloads the router and can be triggered from command-line interface:
event manager applet forceReloadNow you can use the exec "event manager run forceReload" Tcl command in your Tcl script to run the applet (and reload the router).
event none
action 1.0 reload
Notes:
- To execute file management commands from Tcl shell, you have to disable prompts with file prompt quiet configuration command;
- This article is part of You've asked for it series.
typeahead "no\n\n"
exec "reload"
Works like a charm.
Sadly, the typeahead does not work on IOS-XE anymore. I created a forum post on the cisco website about this: https://community.cisco.com/t5/switching/ios-xe-tcl-typeahead-not-working/td-p/4405404