COVID-19: Hubken have smoothed the transition to e-learning for hundreds of organisations Get in touch today

A common problem we see when performing health checks of our customers' Moodle sites is the "cron" process not working.

It's configured correctly, and starts to run but doesn't get to the end. There can be a variety of causes for this, such as database issues or problems with third-party plugins. This post shows you how a system administrator can check if this is running correctly. First some background:


What is Moodle "Cron"?

The "cron" process is an essential part of a Moodle site. If it's not being run, or not running correctly, then the site tasks that depend on this (e.g. course completion or emailing forum posts) are not occurring and temporary data may not be getting cleaned up resulting in a site being larger than it needs to be and not performing optimally.

The "cron" is usually set up when a site is installed and it shouldn't require any further intervention. But changes in the platform such as PHP and MySQL versions, and changes to Moodle and plugin versions can sometimes introduce unexpected problems. Unfortunately, any "cron" failure is silent: no error message occurs.


How to check if your Moodle "Cron" runs correctly:

There are two ways to check that "cron" is running correctly:

1. Run it from your browser.

2. Run it from the command line.

To run "cron" from the browser, enter your site's web address followed by "/admin/cron.php", e.g.:

Mozilla Firefox browser window with Moodle Cron information and settings

For this to work, the option "Cron execution via command line only" under "Site administration" - "Security" - "Site policies" must be unticked and if "Cron password for remote access" is set, this must be supplied, e.g. "/admin/cron.php?password=your_password".

Using the command line is the best way to test "cron" as you can use the exact command being used for the scheduled task.

If you're using Linux, copy the command from the crontab entry. If this is redirecting the output, e.g. with "> /dev/null 2>&1", do not include this as this removes the output we want to check. A sample command and output is shown below:

Linux command in Crontab entry for Moodle Cron information and settings

On Microsoft Windows open a "Command Prompt" window (normally this must be run as an Administrator). Then copy the command and parameters from the scheduled task in the "Task Scheduler" console. Make sure you run "php.exe" here instead of "php-win.exe" as the latter suppresses output. You may need to put the command in quotes if it contains spaces, e.g.:

"C:\Program Files (x86)\PHP\php.exe" -f D:\Apache22\moodle\admin\cli\cron.php.

A sample command and output is shown below:

Windows Command Prompt for Moodle Cron output

(There are other ways to run the "cron", e.g. using moodlecron.exe or curl, these are not covered here).

In all of the above cases, both using the browser, or the command line, the final lines of the output should be something like:

Cron script completed correctly
Cron completed at 13:18:11. Memory used 11.3MB.
Execution took 8.21016 seconds

If you're seeing error messages, then the next step is to investigate. Maybe it's a problem with a plugin which can be disabled or updated. Maybe you can fix it yourself, perhaps with the help of the Moodle forums. If you're still struggling, maybe a Moodle Partner (like Hubken Group) can help!

One final note. Your site may not have the "cron" set up at all. In this case you will see this message on the "Site administration" - "Notifications" page:

The cron.php maintenance script has not been run for at least 24 hours.

If this is the case, you should get this configured as soon as possible. Comprehensive instructions are available from

If you are setting this up for the first time you may wish to add the following line to "config.php" (or just above the "?>" if it's present) for the first run:

$CFG->noemailever = true;

This will prevent any email being generated which, for an existing site that has had no "cron" running could prevent a lot of out-of-date and unwanted email. Don't forget to remove the line after you have got "cron" working.


Worried your LMS isn't up to scratch?

Get an LMS Health Check from us here at Hubken Group.

We'll give you a detailed, independent review of your self-hosted Moodle or Totara Learn site, checking through the configuration and environment of your LMS, and picking up any common problems that your LMS might have.

So if you think your LMS might need a tune-up, just give us a shout and we'll show you what we can do.



About Hubken:

The Hubken Solution  comprises powerful, flexible and tailored Learning Management System (LMS) services for organisations of all sizes. Leveraging the power of Moodle or Totara  platforms we provide you with the tools to achieve outstanding eLearning outcomes, supporting you in areas including LMS hosting, installation, user training, content development, reporting  and more.

‹‹ Previous Next ››

Related posts

4 Moodle Plug-Ins You Need For 2021

Here at Hubken one of the many things we love about Moodle is the huge number of plug-ins available, in fact there are over 1600 out there and they are being improved all the time.

So where to start if you’re looking for a quick way to improve your Moodle LMS for both learners and system administrators alike?

Online Learning Trends For 2021 – The Hubken View

If there is one thing that 2020 has taught us it’s that online learning is no longer just an add-on function for more enlightened organisations.

E-learning is an absolute essential in a world where the shift towards remote working is likely to be permanent.