Cron is the name of a program that runs predefined tasks on a server at regular intervals. The cron process in Moodle / Totara assists some modules to perform tasks on a scheduled basis. For example, the cron process might tell Moodle / Totara to check all discussion forums so it can mail out copies of new posts to people who have subscribed to that forum.
The article has been split into different sections to make it easier to follow along.
Sections/Summary of the Steps
Before getting into the details of the Cron job, please note the following Sections/Steps.
This article will also expand upon the following.
Section 1:Settings before running the cron job
First of all you have to check your SMTP settings and digest email settings that you find it suitable.
When the email digest is set up, as a user you will get only one email per day instead of an individual messages. In this setting you can specify when digests are emailed.
Setting these features will provide proper functionality, so that the notifications will be properly received.
To set this settings, navigate to the Administration block > Site administration > Plugins > Message Outputs > Email
On the page that loads
- Check the SMTP settings that they are in order
- Select the timing of the email digest
Section 2:Running the cron job
After you checked the email settings, you can run the cron.php script and you will get information about cron.php whether is running or not.
To do this type in this in the address bar:
Where http://yourmoodle.com is the address of your moodle instance.
The page will show the output of the script as it is run by the server. If anything works as it should it will print similar lines at the end of the page:
Cron script completed correctly Execution took 1.938528 seconds
Best Practices and Common Mistakes
Moodle has two settings where the site administrator can have some control of how the Moodle cron process is triggered. This is done from the Site Policies
To set this settings, navigate to Site administration >Security > Site Policies
The first option is if the Cron execution via command line only is selected, then the cron script can be run from the command line only instead of the web.
The second option is the added password. If a password is added then the url should look like this:
Sometimes the cronjob can stop running due to various reasons from system restarts or the quote being backed up for example. If you wanted to check to see if your cronjob is running go to site administration > notifications.