[rancid] Re: Run a command in all the routers

Andrew Partan asp at partan.com
Thu Jun 1 18:49:12 UTC 2006

On Thu, Jun 01, 2006 at 10:44:25AM -0700, Dylan Vanderhoof wrote:
> find . -name router.db |xargs cat |grep up| sed s/:.*:up//g

	clogin -c "show diag" `find . -name router.db | \
	  xargs awk -F: '$3 == "up" && $2 == "cisco" && $1 !~ /^#/ {print $1}'`

Change cisco to the type of device you want the command to run on.

You can also do
	clogin -c "show diag;show version"
if you want to run more then one command.
	clogin -x command_file
if command_file has a list of the commands you want to run.
	clogin -s script_file
if script_file is a more complex expect script.
See share/*.exp for a couple of sample expect scripts.

More information about the Rancid-discuss mailing list