# admin/setting/tasklogging

<div class="mw-content-ltr mw-parser-output" dir="ltr" id="bkmrk-server-settings-syst" lang="en"><div class="sideblock right" style="width: 12em;"><div class="header">[Server settings](/503/en/Server_settings "Server settings")</div><div class="content">

- [System paths](/503/en/System_paths "System paths")
- [Session handling](/503/en/Session_handling "Session handling")
- [HTTP](/503/en/HTTP "HTTP")
- [Maintenance mode](/503/en/Maintenance_mode "Maintenance mode")
- [Cleanup](/503/en/Cleanup "Cleanup")
- [Environment](/503/en/Environment "Environment")
- [Site registration](/503/en/Site_registration "Site registration")
- [Mail configuration](/503/en/Mail_configuration "Mail configuration")
- [OAuth 2 clients](/503/en/OAuth_2_clients "OAuth 2 clients")
- [OAuth 2 services](/503/en/OAuth_2_services "OAuth 2 services")
- <a class="mw-selflink selflink">Scheduled tasks</a>

</div></div>

- [<span class="tocnumber">1</span> <span class="toctext">Managing scheduled tasks</span>](#bkmrk-managing-scheduled-t-1)
- [<span class="tocnumber">2</span> <span class="toctext">Colours</span>](#bkmrk-colours)
- [<span class="tocnumber">3</span> <span class="toctext">Task processing</span>](#bkmrk-task-processing)
- [<span class="tocnumber">4</span> <span class="toctext">Format for scheduling tasks</span>](#bkmrk-format-for-schedulin-1)
- [<span class="tocnumber">5</span> <span class="toctext">Fail delay</span>](#bkmrk-fail-delay)
- [<span class="tocnumber">6</span> <span class="toctext">Running individual tasks</span>](#bkmrk-running-individual-t-1)
- [<span class="tocnumber">7</span> <span class="toctext">Run scheduled tasks ASAP and asynchronously on server</span>](#bkmrk-run-scheduled-tasks--1)
- [<span class="tocnumber">8</span> <span class="toctext">Ad hoc tasks</span>](#bkmrk-ad-hoc-tasks)
- [<span class="tocnumber">9</span> <span class="toctext">Tasks running now</span>](#bkmrk-tasks-running-now)
- [<span class="tocnumber">10</span> <span class="toctext">Launching a task from CLI</span>](#bkmrk-launching-a-task-fro-1)

</div>## <span class="mw-headline" id="bkmrk-managing-scheduled-t-1">Managing scheduled tasks</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

An administrator can schedule routine tasks very precisely from *Site administration &gt; Server &gt; Tasks &gt; Scheduled tasks.*

Note that you still need to run the [cron scripts](/503/en/Cron "Cron") (admin/cli/cron.php or [https://yoursite/admin/cron.php](https://yoursite/admin/cron.php)) at regular intervals. It is recommended that the cron is run every minute.

Clicking the edit icon allows the administrator to specify the minute/hour/day/month or day of the week the task is to be run. It is also possible to reset the task to its default setting or disable it completely.

The column 'Next run' provides information on whether a plugin or a task is disabled (as well as the date that a task will next run).

## <span class="mw-headline" id="bkmrk-colours">Colours</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

If you see a scheduled task shaded yellow/orange this means the setting has been changed from default.

If you see a scheduled task shaded red, this means it has reached its maximum retry, i.e. it is almost certainly not working.

<figure class="mw-halign-none" id="bkmrk-scheduled-task-colou" typeof="mw:File/Frame">[![](https://docs.moodle.org/503/en/images_en/9/9b/scheduledtaskcolours.png)](/503/en/File:scheduledtaskcolours.png)<figcaption>Scheduled task colours</figcaption></figure>## <span class="mw-headline" id="bkmrk-task-processing">Task processing</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

From *Site administration &gt; Server &gt; Tasks &gt; Task processing*, you can disable/enable cron and view and modify the processing of scheduled and ad hoc tasks.

The length of time to keep polling for additional tasks can be managed from the *Keep alive* setting (with a default value of 3 minutes.)

## <span class="mw-headline" id="bkmrk-format-for-schedulin-1">Format for scheduling tasks</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

When typing into the fields, the format is the same as for Unix cron. Examples are as follows and are according to which field you are editing:

```
* is every minute, hour, day, month
*/2 is every two minutes, every two hours or every second day
2-10 is every minute between two and ten past the hour or every hour between 2 and 10 am 
0 is every Sunday
1 is every Monday or every January
2,5 is the second and 5th of the month, or February and May, or Tuesday and Friday.
```

Default: R means that a random value is picked when saving changes. This helps to distribute tasks more equally instead of running too many of them on the hour, midnight etc.

## <span class="mw-headline" id="bkmrk-fail-delay">Fail delay</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

If you're trying to debug a cron task, you may notice the Fail Delay becomes populated with a number. This is the time in seconds the cron will delay running the task. To sidestep this problem for development purposes, take a look at the Scheduled Tasks section here: [Administration via command line#Scheduled tasks](/503/en/Administration_via_command_line#Scheduled_tasks "Administration via command line").

## <span class="mw-headline" id="bkmrk-running-individual-t-1">Running individual tasks</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

To be able to run individual scheduled tasks via 'Run now' links on the scheduled tasks page, 'Allow 'Run now' for scheduled tasks' (tool\_task \| enablerunnow) in Site administration / Security / Site security settings should be enabled AND 'Path to PHP CLI' (pathtophp) in *Site administration &gt; Server &gt; System paths* should be set.

<figure class="mw-halign-none" id="bkmrk-scheduled-tasks-with" typeof="mw:File/Frame">[![](https://docs.moodle.org/503/en/images_en/8/80/examplescheduledtasks.png)](/503/en/File:examplescheduledtasks.png)<figcaption>Scheduled tasks with 'Run now' option.</figcaption></figure>## <span class="mw-headline" id="bkmrk-run-scheduled-tasks--1">Run scheduled tasks ASAP and asynchronously on server</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

<span class="small-info-right">[New feature  
in **Moodle 5.3**!](/503/en/Category:New_features "Category:New features")</span>

Admins can now choose to run a scheduled task in the background (asynchronously) via cron, instead of running it directly in a browser.

Before this change, the only way to manually trigger a scheduled task was to click ‘Run now’ in Site administration &gt; Server &gt; Scheduled tasks. This ran the task in the browser, which could time out if the task took a long time to complete.

Now, admins can choose ‘Run ASAP’, shown with ‘Run now’ option for any task that isn't already scheduled to run immediately. After confirming the action message, the task is queued to run in the background the next time cron runs, so there is no risk of a browser timeout.

A success notification confirms the task has been queued, and ASAP is displayed in the ‘Next run’ column for the task until cron picks it up.

<figure class="mw-halign-none" id="bkmrk-run-scheduled-tasks--2" typeof="mw:File/Thumb"><span>![Run scheduled tasks ASAP and asynchronously on server](https://docs.moodle.org/503/en/images_en/thumb/f/f6/MDL85548scheduledtasksrunasap%281%29.png/600px-MDL85548scheduledtasksrunasap%281%29.png)</span><figcaption>Run scheduled tasks ASAP and asynchronously on server </figcaption></figure>## <span class="mw-headline" id="bkmrk-ad-hoc-tasks">Ad hoc tasks</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

From *Site administration &gt; Server &gt; Tasks &gt; Ad hoc tasks* you can see ad hoc tasks grouped by class name.

Clicking on a component/class name you then have a link to run that particular ad hoc task from the UI.

Ad hoc tasks can be also be run individually from the command line via admin/cli/adhoc\_task.php. Options are:

- Run by id
- By class
- Only failed

It is also possible to limit the number of tasks to run, for example no more than four at a time.

See [MDL-70975](https://tracker.moodle.org/browse/MDL-70975) for example CLI commands to run the above ad hoc tasks.

## <span class="mw-headline" id="bkmrk-tasks-running-now">Tasks running now</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

Currently running tasks may be viewed from *Site administration &gt; Server &gt; Tasks &gt; Tasks running now*.

<figure class="mw-halign-none" id="bkmrk-tasks-running-now-1" typeof="mw:File/Frame">[![](https://docs.moodle.org/503/en/images_en/d/d1/TasksRunningNow.png)](/503/en/File:TasksRunningNow.png)<figcaption>Tasks running now</figcaption></figure>## <span class="mw-headline" id="bkmrk-launching-a-task-fro-1">Launching a task from CLI</span><span class="mw-editsection-divider"> \| </span><span class="mw-editsection-bracket">\]</span>

You can also launch individual task from Command Line Interface (see [Administration via command line](/503/en/Administration_via_command_line#Scheduled_tasks "Administration via command line")).

---

<small>Source: [docs.moodle.org/503/en/admin/setting/tasklogging](https://docs.moodle.org/503/en/admin/setting/tasklogging) — MoodleDocs (GPL) · Imported 2026-11-10.</small>