I detected that standard crontab definition are not supported by the scheduledtask class, while verifying definition of crontab definitions. Afterwards, I detected that whe moodle form when editing a single task definition is even more restrictive on the crontab definition.
Some examples of standard crontab definition not supported:
- 1/10 on minutes: it is not supported, neither from class and form.
- 1-59/10 on minutes (equivalent to 1/10): it is not supported by the form, but it IS supported by the class.
- 07,20-23 on hours: it is not supported by the form, but it IS supported by the class.
I usually use https://crontab.guru/ to check standard crontab definitions. Non stantard definitions are explicited on the same web, so it is easy to detect them.
Reasons why it is needed:
- Moodle standard definition of execution steps of the form `*/10` forces that minute 0 of every hour is forced to run lots of tasks. If we allow them to start a different first minute, we will let to balance the load on different times within every hour.
- Since a task cannot be set up different times, it is impossible to set up execution ranges involving different parts of the day, specially on not so loaded times, like late night and early morning, of the form `0-7,20-23`.
- Set up a new task with crontab of the form `1-59/10 0-7,20-23 * * *`.
- Upgrade Moodle to install it.
- No errors or warnings are detected on the task definition.
- Go to web form and press Save button.
- Form errors arise on minutes and hours definition.
The only way to get something allowed is to put `*/10 0-7 * * *`. Or put all values in a comma separated list, like `1,11,21,31,41,51 0,1,2,3,4,5,6,7,20,21,22,23 * * *`, but then a database error arise `Data too long for column 'hour' `, so there is no way to get the same result.
If I set up the crontab like `1/10 0-7,20-23 * * *`, then, while installing the task during the Moodle upgrade, you see an error on the processes informing that the definition is not supported.