Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-69764

Unsupported standard crontab definitions in scheduledtask and Moodle form

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.8.5
    • Fix Version/s: None
    • Component/s: Tasks
    • Affected Branches:
      MOODLE_38_STABLE

      Description

      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`.

      Full steps:

      1. Set up a new task with crontab of the form `1-59/10 0-7,20-23 * * *`.
      2. Upgrade Moodle to install it.
      3. No errors or warnings are detected on the task definition.
      4. Go to web form and press Save button.
      5. 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.

       

        Attachments

          Activity

            People

            Assignee:
            jpahullo Jordi Pujol-Ahulló
            Reporter:
            jpahullo Jordi Pujol-Ahulló
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: