[rancid] Rancid isn't scanning the f5s from cron job.
Alan McKinnon
alan.mckinnon at gmail.com
Mon Jul 13 20:00:40 UTC 2015
On 13/07/2015 21:51, Ehud Gavron wrote:
> I've found that some of the older rancid scripts work great from a terminal
> logged in with an environment, but fail when run by cron.
This is highly likely to be the OP's root cause, it's a classic mistake
when using cron.
rancid probably can't find the *login scripts as /usr/lib/rancid/bin/ is
unlikely to be in PATH.
Golden rule: Always always always use fully qualified paths everywhere
in scripts launched from cron, and never rely on handy features provided
by the shell to make a user's life easier.
$PATH is a user feature, not a system one. The system works best when
$PATH is not set for cron and friends.
>
> Specifically I have ensured that $HOME is defined for all rancid jobs, and
> have also set the terminal type.
>
> Debugging: in f5rancid, right after the creation of $host.new and $host.raw
> preserve those files, by adding
> cp $host.* /tmp/
>
> That will give you a very good indication of
> - whether the login succeeded
> - what commands were sent
> - what commands got an expected response
> - what commands broke the script
>
> Note: if you want to try and figure out if it's an environmental variable,
> then before doing rancid-run clear all your environmental variables and
> try rancid-run then. If it fails, add them back in to figure out what it
> needs.
>
> Ehud
>
> On 07/13/2015 10:31 AM, Matt Almgren wrote:
>> Very strange behavior here that I can’t pinpoint.
>>
>> When the cron job runs once per day, it doesn’t scan our f5s in multiple locations. But when I run “rancid-run” manually (with no
>> args) it picks them up – no problem.
>>
>> Cron: 59 9 * * * /usr/lib/rancid/bin/rancid-run
>>
>> router.db:
>> <snip>
>> mt-lr01.endor.lan:juniper:up
>> mt-lb03.endor.lan:f5:up
>> mt-lb04.endor.lan:f5:up
>> <snip>
>>
>> Files:
>> -rw-r----- 1 rancid rancid 1072279 Jul 8 11:36 mt-lb04.endor.lan
>> -rw-r----- 1 rancid rancid 1072475 Jul 8 11:36 mt-lb03.endor.lan
>> -rw-r----- 1 rancid rancid 22647 Jul 10 10:01 mt-er01.endor.lan
>> -rw-r----- 1 rancid rancid 22211 Jul 10 10:01 mt-er02.endor.lan
>>
>> Again, running manually, it works just fine.
>>
>> The logs from the cron job show me what I already know:
>>
>>
>> Trying to get all of the configs.
>> mt-lb03.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.crt,ls --full-time --color=never
>> /config/ssl/ssl.key
>> mt-lb04.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.crt,ls --full-time --color=never
>> /config/ssl/ssl.key
>> =====================================
>> Getting missed routers: round 1.
>> mt-lb03.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.crt,ls --full-time --color=never
>> /config/ssl/ssl.key
>> mt-lb04.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.key,ls --full-time --color=never
>> /config/ssl/ssl.crt
>> =====================================
>> Getting missed routers: round 2.
>> mt-lb04.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.crt,ls --full-time --color=never
>> /config/ssl/ssl.key
>> mt-lb03.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.crt,ls --full-time --color=never
>> /config/ssl/ssl.key
>> =====================================
>> Getting missed routers: round 3.
>> mt-lb04.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.key,ls --full-time --color=never
>> /config/ssl/ssl.crt
>> mt-lb03.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.key,ls --full-time --color=never
>> /config/ssl/ssl.crt
>> =====================================
>> Getting missed routers: round 4.
>> mt-lb03.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.key,ls --full-time --color=never
>> /config/ssl/ssl.crt
>> mt-lb04.corp.surveymonkey.com: missed cmd(s): ls --full-time --color=never /config/ssl/ssl.crt,ls --full-time --color=never
>> /config/ssl/ssl.key
>>
>>
>> But when I run it manually:
>>
>>
>>
>> Trying to get all of the configs.
>> All routers sucessfully completed.
>>
>>
>>
>> Anyone have any clues/ideas?
>>
>> Thanks, Matt
>>
>>
>>
>>
>> _______________________________________________
>> Rancid-discuss mailing list
>> Rancid-discuss at shrubbery.net
>> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>>
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>
--
Alan McKinnon
alan.mckinnon at gmail.com
More information about the Rancid-discuss
mailing list