Forum: CFEngine Help
Subject: Integer splayclass equivalent
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,26915,26915#msg-26915

So, I'd like to "repeably randomize" an integer on a host.  Specifically, I'd 
like to use essentially the logic from splayclass or splaytime to pick a time 
to run a cron job.  "Why not run the job from CFEngine?"  Well, because the job 
is to check if cf-execd is running, amd I don't want it to fire off on every 
host at the same time.  But I can't use a random value, because putting a 
random integer into the crontab wouldn't exactly be convergent.

My current idea is to use splayclass to control when I edit crontab, and to 
just use the current minute (possibly along with whichever of current+30 and 
current-30 is greater than 0) for the cron job.  But that seems a tad clunky 
(albeit better than launching a module).  Anyone happen to have a suggestion?  
I think the more general use case for what I'm looking for is randomint, but 
with an extra parameter to make it "predictable_randomint". :)

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to