Closed trungdq88 closed 2 years ago
@trungdq88 - Are you sure about that? You mentioned "per cronjob specs", can you point to where you are referencing? As far as I know and can see based on crontab documentation (source), step values specify an "every" type recurrence. If you wanted an "every 45th minutes" type expression, I would expect an expression like this: 45 * * * *
with no step value.
@bradymholt to be honest I have not read the whole cronjob specs, but it was my understanding the whole time.
I'm a bit lazy to find the correct wording, but I crossed check the "next run time" with any cron job parsers (or see a preview on the internet: https://crontab.guru/, https://cronjob.xyz/), it clearly shows that */45
is not "every 45 minutes".
This Stack Overflow post also gives some info: https://stackoverflow.com/questions/29074816/cron-expression-to-be-executed-every-45-minutes
I think the output on https://cronjob.xyz/ in wrong. I would expect that output for 0/45 * * * *
, not */45 * * * *
. As for https://crontab.guru/, I think I agree with its output of "At every 45th minute.", as */45 * * * *
should simply fire every 45 minutes, regardless of the time it started.
Per the crontab man:
I tested this on a Ubuntu Linux box and confirmed it:
*/45 * * * * /usr/bin/printf '%s %s\n' "$(date)" >> /tmp/timestamp
Can you share the output of the /tmp/timestamp
file?
Can you share the output of the
/tmp/timestamp
file?
Wed Mar 29 11:03:03 MDT 2022
Wed Mar 29 11:48:03 MDT 2022
Wed Mar 29 12:33:03 MDT 2022
Hmm, that is strange indeed. I don't have time to dig into this further, but maybe I'll revisit later.
In the meantime, feel free to close the PR. Thanks for your time looking into this, and thanks for the awesome lib!
Sure thing, thanks!
Thanks for this awesome library!
I found an edge case:
https://github.com/bradymholt/cRonstrue/blob/master/test/cronstrue.ts#L66-L68
That test case is inaccurate.
Same for
*/45 * * * *
.