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

Unsupported standard crontab definitions in scheduledtask and Moodle form

XMLWordPrintable

      I detected that standard crontab definition are not supported by the scheduledtask class, while verifying definition of crontab definitions. Afterwards, I detected that the 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.

       

            jpahullo Jordi Pujol-Ahulló
            jpahullo Jordi Pujol-Ahulló
            Sam Marshall Sam Marshall
            Ilya Tregubov Ilya Tregubov
            CiBoT CiBoT
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 47 minutes
                3h 47m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.