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

Reiner Steib reinersteib+gmane at imap.cc
Thu Jul 20 12:28:31 CEST 2006


On Thu, Jul 20 2006, Lloyd Zusman wrote:

> Reiner Steib <reinersteib+gmane at imap.cc> writes:
>> What's wrong with the following crontab entry?
>>
>> | */5 * * * * sleep $(($RANDOM % 60)); /usr/sbin/fetchnews
>
> I believe that it will only work if your shell is bash or zsh.

Yes, it's not present in every (bourne) shell, but in most of them[1].
If your cron shell doesn't have $RANDOM, you could use $$ or
/bin/bash -c 'sleep $(($RANDOM % 60))'.

My point is that I don't think that it's worth to add such an option
to fetchnews.  YMMV, of course.

Bye, Reiner.

[1]

$ uname -rs
SunOS 5.10
$ /bin/sh -c 'echo $RANDOM'

$ /usr/xpg4/bin/sh -c 'echo $RANDOM'
30812
$ /usr/bin/ksh -c 'echo $RANDOM'
31720

sh-posix(1) in HP-UX 10.10 also mentions $RANDOM.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




More information about the leafnode-list mailing list