[rancid] Question about custom command-file and expect

Simone Felici s.felici at mclink.eu
Wed Feb 25 10:41:12 UTC 2015


I would like to connect on a device using rancid and execute some commands *only* in some 
circumstances. clogin works perfectly to login and using -x to specify a command-list file or -c to 
execute commands works as well. But what I need is that, based on the response of a command I could 
execute another command or not.

I.e., after login on a router, executing:

#show ip route <IP_ADDRESS>

IF I obtain:

% Subnet not in table

I need to execute some commands.

If I obtain:
Routing entry for <IP_ADDRESS>

THEN I need to do something different.

I've seen there is a [-s script-file] where I could add an expect script. Trying to use it, seems 
the whole content of clogin is bypassed using the script file. Would be possible to use clogin for 
login action and then, at the end, use only the script-file to add the rest of the commands with the 

Thanks for the help!


More information about the Rancid-discuss mailing list