2 ms·
Long ago, I had to write a utility to backup the configurations settings from all the network devices in a given network. At the time, the network consisted of
by RHSeeger 10y ago
Long ago, I had to write a utility to backup the configurations settings from all the network devices in a given network. At the time, the network consisted of many, many different types of routers, switches, and the like.
For many of the devices, there was a way to fetch the config but it required logging into the device (generally telnet) and navigating a menu to "send" the config somewhere. Using expect to do that was a fantastic way to handle it.
There's also a number of cases where you want output from a command line program "as if run by a user at a terminal". For some programs, they change the output (ie, removing color codes, etc) if the output is not going to a terminal. Expect does a fantastic job of pretending to be a terminal.
Also, it's Tcl, and I love Tcl. It's (possibly tied) at the top of my list for languages. So much fun and more flexible than anything that doesn't support lisp level macros.
- EvanAnderson 10y agoIn case somebody's interested in a tool that does the kind of thing you describe re: network devices after reading your comment I thought it might be helpful to include a link RANCID: http://www.shrubbery.net/rancid/ http://www.shrubbery.net/rancid/ Silly backronym name aside, RANCID is a very handy tool and uses expect to do a lot of the 'dirty work'.