Discussion:
[rancid] "sh: clogin: command not found" when run from cron
Chris Hunt
2012-12-11 17:18:23 UTC
Permalink
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:
!
[***@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#
[***@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 ***@example.com
#

Can someone please hit me with a clue bat?

Cheers,
-Chris
Adam Korab
2012-12-11 19:26:09 UTC
Permalink
How about specifying the full path e.g., /home/rancid/bin/rancid-run
instead of just rancid-run?

--Adam
--
Adam Korab
Post by Chris Hunt
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
!
router-2.example.com
spawn ssh -c 3des -x -l nocservices router-2.example.com
...
router-2>enable
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#
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
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
router-2.example.com: End of run not found
!
#
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/var/rancid:/usr/local/rancid/bin:/usr/libexec/rancid:.
SHELL=/bin/bash
#
Can someone please hit me with a clue bat?
Cheers,
-Chris
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Chris Hunt
2012-12-11 20:50:40 UTC
Permalink
Post by Adam Korab
How about specifying the full path e.g., /home/rancid/bin/rancid-run
instead of just rancid-run?
--Adam
--
Adam Korab
Post by Chris Hunt
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
!
router-2.example.com
spawn ssh -c 3des -x -l nocservices router-2.example.com
...
router-2>enable
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#
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
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
router-2.example.com: End of run not found
!
#
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/var/rancid:/usr/local/rancid/bin:/usr/libexec/rancid:.
SHELL=/bin/bash
#
Can someone please hit me with a clue bat?
Cheers,
-Chris
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Mr. Korab,
Thanks for the reply. I had tried that, but apparently there are some
additional non-absolute calls within the code itself that were failing
due to a misconfigured path. As John Heasley helpfully pointed out,
there is yet another path variable in /etc/rancid/rancid.conf. I copied
the path from the rancid user's crontab into rancid.conf and away it
went! I can't believe how much time I spent on that before asking the
group...Many thanks to Mr. Heasley. FIXED!

Cheers,
-Chris
bob watson
2012-12-12 00:27:05 UTC
Permalink
Chris,

I would get a debug statement in the PERL to see what the environment is
there. There are many ways of doing that. PATHs can also be set up in
rancid.conf.

My main experience is with Solaris and RANCID so I am not expert on CENT OS
(Like Redhat Enterprise Linux?). As a rule, to make code portable, never
rely on the crontab path as a lot off *nix's do not support it!

Good luck!

Now, remember to nock off work before Christmas shopping has been done by
your significant other!

Cheers,

Bob
Post by Chris Hunt
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
!
router-2.example.com
spawn ssh -c 3des -x -l nocservices router-2.example.com
...
router-2>enable
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#
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
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
router-2.example.com: End of run not found
!
#
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/var/rancid:/usr/local/rancid/bin:/usr/libexec/rancid:.
SHELL=/bin/bash
#
Can someone please hit me with a clue bat?
Cheers,
-Chris
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Loading...