Moodle Cron

Although it is not an obvious part of the installation of Moodle, setting up Cron is very important when it comes to Moodle.

For example, some emails are sent out immediately while others are scheduled and only sent out when cron runs. Other things that are often affected by Cron jobs are report generation. Eventually, if you never run cron, your Moodle site will also stop working so it is important to make sure that this is setup properly. This happened to one of our clients. They had their own people do the installation and they skipped the step of setting up Cron. A year and a bit later, they contacted us thinking someone had hacked their site. It turned out they had just never run the Cron job that does Moodle maintenance.

You can check the last time Cron was run by going to the Site Administration > Notifications.

If cron hasn't run in the last 24 hours, you will see something like:

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

If you don't see anything about it, chances are that Cron is being run automatically every once in a while.

There is also the possibility that an error is preventing Cron from working properly. The likelihood of this happening is much lower since Moodle 2.7. You should be able to manually run Cron and see the results by logging in as a Moodle administrator and going to:

http://example.com/admin/cron.php

Just replace "http://example.com/" with the URL to your Moodle site. There are some settings in Moodle which can prevent this URL from working so, if it doesn't seem to work, don't assume that Cron doesn't work. It might just be some Moodle settings. If Cron is running regularly, the displayed log might be pretty short as there are items which are only run once a day which may not appear in the list. This is especially noticeable if you run Cron manually twice in a row.

If you are running Moodle on a Unix/Linux based server, documentation on how to set it up can be found on Moodle.org's Cron page.

If you are running Moodle on Windows, you may have noticed that "cron" doesn't exist. However Windows does also include a Scheduler. You will find details on how to set that up by going to the Cron with Windows OSpage on Moodle.org.

It's never too late to setup Cron. Not only will you find that your Moodle site works better, it may actually work faster too.


Add a comment:

Your email address will not be published. Required fields are marked *