Re: Creating a randomized cron entry
On Thu, Dec 15, 2005 at 10:59:20AM +0100, Stefano Zacchiroli wrote:
> On Thu, Dec 15, 2005 at 09:05:03AM +0100, Florian Weimer wrote:
> > What is the recommended way to achieve this? Include a script, to be
> Not a recommended way, but what about creating an entry which is
> executed every minute and contains a "toss a coin" like function with a
> probability of 1 / (number of minutes in a day) probability of success?
This of course has the possibility of running multiple times, so you
might have to include into the cronjob a test:
rm /var/run/foo/ran-today 2>/dev/null && exit 0
It also doesn't guarantee that it runs at all in any given day, or
that the hosts don't all peg the network at the same time.