[leafnode-list] Re: [PATCH] Random initial delay for fetchnews

Thomas Schwinge schwinge-lists-leafnode at nic-nac-project.de
Thu Jul 20 19:07:14 CEST 2006


On Thu, Jul 20, 2006 at 04:47:36PM +0200, Matthias Andree wrote:
> Reiner Steib <reinersteib+gmane at imap.cc> writes:
> 
> > What's wrong with the following crontab entry?
> >
> > | */5 * * * * sleep $(($RANDOM % 60)); /usr/sbin/fetchnews
> >
> > BTW, I think fetching so often is not very friendly, but of course
> > your provider may allow it.
> 
> Not portable. I still think we should ship a general-purpose
> "randomsleep, then exec" program (as wrapper) instead.

What about that one?

#v+
$ set -x
$ sleep `expr $$ : '.*\(..\)'`
++ expr 1037 : '.*\(..\)'
+ sleep 37
#v-

That should be random enough for being used from cron.  The delay would
then be 0 to 99 seconds.


Regards,
 Thomas



More information about the leafnode-list mailing list