Project

General

Profile

Actions

Bug #4256

closed

Weird calculations of minutes in cron cmd

Added by Francois Suter over 15 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Must have
Category:
scheduler
Target version:
-
Start date:
2009-08-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If you set a weird frequency like:

*/23 * * * *

and you have a start date at 17:00, for example, you might expect your event to run 17:23, 17:46, 18:09, 18:32, 18:55, 19:18, etc.

Instead, the event gets scheduler for 17:23, 17:46, 18:00, 18:23, 18:46, 19:00, etc.

Actions #1

Updated by Francois Suter over 15 years ago

  • Status changed from New to Rejected
  • Assignee set to Francois Suter

This is not a bug. I just opened a report to document that behavior. It should probably go in the manual.

Any of the 5 values that make up a cron cmd can used a syntax like */<number>. This is called "steps". It means that a number of values should be skipped in the list of possible values.

In the case of minutes, the list of possible values is the range 0-59. So a syntax like */23 means "skip 23 values each time, within the allowed range". So the first allowed value (starting from 0) is 23, the next one is 46. The next value would be 69, which is out of range, so that cron falls back to the first value in the range, hence 0.

It might be worth making a note about this in the documentation, hinting that steps should use a number that's a divider of the range.

Actions #2

Updated by Francois Suter over 15 years ago

Actually I'm wondering about this still. What I wrote is what I understood from the crontab description (man of crontab(5) in Mac OS X). Now let's consider something like:

0 */7 * * *

a job that would run every seven hour. I haven't checked what happens in the Scheduler with such a cron cmd, but if the calculation behaves the same way as for the minutes, it means the event will run at 7:00, 14:00, 21:00 and 0:00, which is definitely not every 7 hours...

Actions #3

Updated by Francois Suter over 15 years ago

I received the following feedback from Markus Friedrich. This information confirms that the current behaviour is correct.

after I had read your reports I was a little bit unsure about the right
behaviour, too. Now I've compared the behaviour of the cron daemon and
the generated execution lists of the gabriel extension, the daemon
behaved exactly like you described.

*/23 * * * * => is executed on 00:00, 00:23, 00:46, 01:00...
0 */7 * * * => is executed on 00:00, 07:00, 14:00, 21:00, 00:00...

The generated execution lists of the gabriel look the same, so I think
there's no need to change anything. But I agree that it could be
confusing and that an example should be included in the documentation.

Actions #4

Updated by Francois Suter over 12 years ago

  • Status changed from Rejected to Closed
Actions #5

Updated by Michael Stucki almost 11 years ago

  • Category set to scheduler
Actions #6

Updated by Michael Stucki almost 11 years ago

  • Project changed from 739 to TYPO3 Core
  • Category changed from scheduler to scheduler
Actions

Also available in: Atom PDF