Hi,
On Wed, Jul 3, 2024 at 12:31 PM Jason McIntyre <[email protected]> wrote:
>
> On Wed, Jul 03, 2024 at 10:52:46AM -0300, K R wrote:
> > >Synopsis: crontab(5) clarification: "~" field is evaluated once at
> > >install time
> > >Category: documentation system amd64
> > >Environment:
> > System : OpenBSD 7.5
> > Details : OpenBSD 7.5-current (GENERIC) #150: Wed Jun 26
> > 20:30:54 MDT 2024
> >
> > [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
> >
> > Architecture: OpenBSD.amd64
> > Machine : amd64
> > >Description:
> > The crontab(5) manpage could be more explicit about the fact
> > that a "~" char only gets evaluated to a random value once, at
> > table install time.
> >
> > From the EXAMPLES section:
> >
> > # run hourly at a random time within the first 30 minutes of the
> > hour
> > 0~30 * * * * /usr/libexec/spamd-setup
> >
> > "run hourly at a random time" could me interpreted as "run
> > hourly, with a different random minute every hour".
> > This is not the case and may be unexpected for some users.
> >
> > >How-To-Repeat:
> > # some initial random minute, repeating itself every hour
> > ~ * * * * date >> /tmp/LOG
> >
> > >Fix:
> > Just clarify that "~" will be evaluated at table install time
> > and then be reused.
> >
> > Thanks,
> > --Kor
> >
>
> hi.
>
> i agree it might not be totally clear, initially, that it works that
> way. but if you think about it, if it ran at, for example, different
> minute intervals, then you could have something run at 59 minutes past
> the hour, and then at 1 minute past the next hour - a difference of two
> minutes. that would hardly qualify as "hourly".
>
> i think the doc provides enough of a hint ("a radom value ... may be
> obtained") when combined with that logic. i'm not sure that adding the
> extra text to try and explain that would be worth it. if you feel
> unconvinced by that, propose a text which you think improves it. but i'm
> not sure it's needed.
I believe a single sentence could be added to clarify this. This
paragraph is the first place where "~" is explained:
from:
A random value (within the legal range) may be obtained by using the ‘~’
character in a field. The interval of the random value may be specified
explicitly, for example “0~30” will result in a random value between 0
and 30 inclusive. If either (or both) of the numbers on either side of
the ‘~’ are omitted, the appropriate limit (low or high) for the field
will be used.
to:
A random value (within the legal range) may be obtained by using the ‘~’
character in a field. The interval of the random value may be specified
explicitly, for example “0~30” will result in a random value between 0
and 30 inclusive. If either (or both) of the numbers on either side of
the ‘~’ are omitted, the appropriate limit (low or high) for the field
will be used. The '~' character gets expanded to a random value
only once, at table install time.
Please see if this addition could be useful.
--Kor
>
> jmc
>