[rancid] "sh: clogin: command not found" when run from cron

Chris Hunt dharmachris at gmail.com
Tue Dec 11 17:18:23 UTC 2012


Hello All,
    I'm having some trouble getting rancid to work properly after
migrating to CentOS 5.8.  I can successfully run it from the BASH while
logged in as the rancid user:
!
[rancid at noc ~]$ clogin -c 'show version' router-2.example.com
router-2.example.com
spawn ssh -c 3des -x -l nocservices router-2.example.com
 ...
router-2>enable
Password:
router-2#
router-2#terminal length 0
router-2#show version
Cisco IOS Software, 7200 Software ....
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
...
router-2 uptime is 3 years, 17 weeks, 3 days, 22 hours, 46 minutes
...
3 FastEthernet interfaces
1 Virtual Private Network (VPN) Module
125K bytes of NVRAM.

62976K bytes of ATA PCMCIA card at slot 1 (Sector size 512 bytes).
4096K bytes of Flash internal SIMM (Sector size 256K).
Configuration register is 0x2102

router-2#
[rancid at noc ~]$ rancid -d router-2.example.com
executing clogin -t 90 -c"show version;show redundancy secondary;show
idprom backplane;show install active;show env all;show rsp
chassis-info;show gsr chassis;show diag chassis-info;show boot;show
bootvar;show variables boot;show flash;dir /all nvram:;dir /all
bootflash:;dir /all slot0:;dir /all disk0:;dir /all slot1:;dir /all
disk1:;dir /all slot2:;dir /all disk2:;dir /all harddisk:;dir /all
harddiska:;dir /all harddiskb:;dir /all sup-bootflash:;dir /all
sup-microcode:;dir /all slavenvram:;dir /all slavebootflash:;dir /all
slaveslot0:;dir /all slavedisk0:;dir /all slaveslot1:;dir /all
slavedisk1:;dir /all slaveslot2:;dir /all slavedisk2:;dir /all
slavesup-bootflash:;dir /all sec-nvram:;dir /all sec-bootflash:;dir /all
sec-slot0:;dir /all sec-disk0:;dir /all sec-slot1:;dir /all
sec-disk1:;dir /all sec-slot2:;dir /all sec-disk2:;show controllers;show
controllers cbus;show diagbus;show diag;show module;show spe
version;show c7200;show inventory raw;show vtp status;show vlan;show
vlan-switch;show debug;more system:running-config;show
running-config;write term" router-2.example.com
PROMPT MATCH: router-2#
HIT COMMAND:router-2#show version
    In ShowVersion: router-2#show version
TYPE = 7200
HIT COMMAND:router-2#show redundancy secondary
    In ShowRedundancy: router-2#show redundancy secondary
HIT COMMAND:router-2#show idprom backplane
    In ShowIDprom: router-2#show idprom backplane
....
HIT COMMAND:router-2#write term
    In WriteTerm: router-2#write term
!

But when run from the rancid user' crontab, it fails saying "The
following routers have not been successfully contacted for more than 4
hours." then lists the router.  The logfile shows:
sh: clogin: command not found
!
router-2.example.com: missed cmd(s): dir /all slavedisk2:,show rsp
chassis-info,dir /all sec-slot2:,show diag,dir /all disk1:,show gsr
chassis,dir /all sec-nvram:,show diag chassis-info,dir /all disk2:,dir
/all sec-bootflash:,show spe version,dir /all slaveslot2:,dir /all
disk0:,show install active,show bootvar,dir /all slaveslot0:,dir /all
sec-slot1:,dir /all harddiska:,dir /all slavenvram:,show flash,dir /all
sec-disk2:,dir /all slavesup-bootflash:,dir /all sec-disk0:,dir /all
harddiskb:,show variables boot,show boot,show inventory raw,dir /all
slavedisk1:,show env all,show module,show controllers,show diagbus,more
system:running-config,dir /all slavedisk0:,show debug,show idprom
backplane,dir /all bootflash:,dir /all sec-slot0:,dir /all
sec-disk1:,write term,show vtp status,dir /all sup-bootflash:,dir /all
slot2:,dir /all harddisk:,dir /all slot0:,dir /all sup-microcode:,show
vlan,dir /all slavebootflash:,show controllers cbus,dir /all
slaveslot1:,dir /all nvram:,show version,show vlan-switch,show
redundancy secondary,show running-config,show c7200,dir /all slot1:
router-2.example.com: End of run not found
!

I suspected a path issue, so I added the path to the crontab file:

#
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/var/rancid:/usr/local/rancid/bin:/usr/libexec/rancid:.
SHELL=/bin/bash
*/5 * * * * rancid-run -m me at example.com
#

Can someone please hit me with a clue bat?

Cheers,
-Chris


More information about the Rancid-discuss mailing list