Discussion:
[rancid] Setting $OLDTIME per RANCID group or device
Justin Shore
2007-12-20 01:24:10 UTC
Permalink
I have a need to define $OLDTIME (or disabling the feature) per group or
individual device. I have a number of unreliable remote sites (owner
residences, roving demo kits, etc) that are only up occasionally. I'd
like to not get the alerts from RANCID for just those particular device
or the RANCID group that the devices belong to. Is there an easy way to
do this? If it helps, I poll individual groups with rancid-run rather
than simply running rancid-run with no arguments. ie,

0 */1 * * * rancid-run abc
0 */1 * * * rancid-run def
0 */1 * * * rancid-run remote

Can I simply define $OLDTIME on the CLI in my crontab on the specific
crontab entries that need to be changed and then let the default OLDTIME
in the config file take over to all the other entries?

Thanks
Justin
john heasley
2007-12-20 01:50:26 UTC
Permalink
Post by Justin Shore
I have a need to define $OLDTIME (or disabling the feature) per group or
individual device. I have a number of unreliable remote sites (owner
residences, roving demo kits, etc) that are only up occasionally. I'd
like to not get the alerts from RANCID for just those particular device
or the RANCID group that the devices belong to. Is there an easy way to
do this? If it helps, I poll individual groups with rancid-run rather
than simply running rancid-run with no arguments. ie,
0 */1 * * * rancid-run abc
0 */1 * * * rancid-run def
0 */1 * * * rancid-run remote
Can I simply define $OLDTIME on the CLI in my crontab on the specific
crontab entries that need to be changed and then let the default OLDTIME
in the config file take over to all the other entries?
yes, if you change the definition in rancid.conf, if you use it, to
something more like

OLDTIME=${OLDTIME:-whatevervalueyouuse}
Justin Shore
2007-12-20 14:34:24 UTC
Permalink
Post by john heasley
Post by Justin Shore
I have a need to define $OLDTIME (or disabling the feature) per group or
individual device. I have a number of unreliable remote sites (owner
residences, roving demo kits, etc) that are only up occasionally. I'd
like to not get the alerts from RANCID for just those particular device
or the RANCID group that the devices belong to. Is there an easy way to
do this? If it helps, I poll individual groups with rancid-run rather
than simply running rancid-run with no arguments. ie,
0 */1 * * * rancid-run abc
0 */1 * * * rancid-run def
0 */1 * * * rancid-run remote
Can I simply define $OLDTIME on the CLI in my crontab on the specific
crontab entries that need to be changed and then let the default OLDTIME
in the config file take over to all the other entries?
yes, if you change the definition in rancid.conf, if you use it, to
something more like
OLDTIME=${OLDTIME:-whatevervalueyouuse}
John,

Thanks for the reply. I'm familiar with bash syntax to append to a
variable (like PATH) but I can't think of any syntax to replace the
value of a variable if the environment value has already been defined,
except with a an if statement. Is that what you have above does?

So I could modify my rancid.conf to read

OLDTIME=${OLDTIME:4}; export OLDTIME

That would give me a default value of 4 hours overall for the majority
of my gear. Then, in my crontab I can do

0 */1 * * * rancid-run site-a
0 */1 * * * rancid-run site-b
0 */1 * * * export OLDTIME=99999999; rancid-run remote

The lengthy time would effectively prevent OLDTIME from running for that
one single RANCID group. Am I understanding what you're saying correctly?

Thanks
Justin
john heasley
2007-12-20 18:16:44 UTC
Permalink
Post by Justin Shore
Thanks for the reply. I'm familiar with bash syntax to append to a
variable (like PATH) but I can't think of any syntax to replace the
value of a variable if the environment value has already been defined,
except with a an if statement. Is that what you have above does?
So I could modify my rancid.conf to read
OLDTIME=${OLDTIME:4}; export OLDTIME
Sorry, I typo'd. I meant :=, which should provide the value 4 if the
variable is not set. The point is, if you did not set it your environment
as you've done below, it will set it.
Post by Justin Shore
That would give me a default value of 4 hours overall for the majority
of my gear. Then, in my crontab I can do
0 */1 * * * rancid-run site-a
0 */1 * * * rancid-run site-b
0 */1 * * * export OLDTIME=99999999; rancid-run remote
The lengthy time would effectively prevent OLDTIME from running for that
one single RANCID group. Am I understanding what you're saying correctly?
Thanks
Justin
Justin Shore
2007-12-20 19:06:14 UTC
Permalink
Post by john heasley
Sorry, I typo'd. I meant :=, which should provide the value 4 if the
variable is not set. The point is, if you did not set it your environment
as you've done below, it will set it.
I see. I thought the dash was eroneous so I omitted it. So I now have

OLDTIME=${OLDTIME:=4}; export OLDTIME

I'll give it a whirl. Thanks for the help.

Justin

Loading...