Discussion:
[rancid] rancid with sec issue
Ivaylo Terziyski
2010-03-09 00:42:39 UTC
Permalink
Hi everybody,

I am using SEC with RANCID to make configuration updates on-demand.
I have managed to configure SEC to scan TACACS+ log and initiate 'rancid-run -r hostname' command.
But if there are two users at the same time in two different devices configuring I see in my logs:

hourly config diffs failed: /tmp/.<group>.run.lock exists

and there are no diffs collected at all.
I will be appreciate some help resolving this issue.
David Clement
2010-03-09 01:20:32 UTC
Permalink
I haven't offered any such suggestions in the past on this list b/c I
figured others would know better, so take this for what it's worth:

you might try calling a wrapper script from SEC (instead of directly calling
rancid-run -r hostname) that can wait for the prior run of RANCID to
complete. If you add some controls to ensure you don't fire off too many
waiting wrapper scripts, it might be even safer:

#!/usr/bin/perl

my ($host) = shift;

my $lockFile = '/tmp/*<insert group name here>*.run.lock # lock file name
that RANCID creates while running
my $sleepTime = 60; # seconds to wait for lockfile to go away
my $sleepCount = 0; # how many times the script has looked for the
lockfile, found it and waited
my $sleepMax = 10; # maximum number of times to sleep

while (-e $lockFile) {
if ($sleepCount >= $sleepMax) {
# add email notification here
die "wanted to run RANCID for host '$host' but couldn't ".
"wait any longer for lockfile to go away. ".
"waited $sleepTime seconds $sleepCount times.";
}
$sleepCount++;
sleep $sleepTime;
}

system("rancid-run -r $host");

Dave
Post by Ivaylo Terziyski
Hi everybody,
I am using SEC with RANCID to make configuration updates on-demand.
I have managed to configure SEC to scan TACACS+ log and initiate
'rancid-run -r hostname' command.
But if there are two users at the same time in two different devices
hourly config diffs failed: /tmp/.<group>.run.lock exists
and there are no diffs collected at all.
I will be appreciate some help resolving this issue.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Loading...