Today, we’re diving into Moodle admin hint number two: how to run Cron manually.
What is Cron?
First, let’s understand what Cron is. Cron is a program that runs on your server at specific, scheduled times. Its primary function is to perform background tasks within Moodle. This includes everything from cleaning up log files, managing student enrollments and unenrollments, sorting out grades, and a whole host of other essential operations that keep your Moodle site running smoothly. Essentially, Cron automates many of the routine maintenance and data management tasks.
Why Would You Need to Run Cron Manually?
On occasion, you might want to manually trigger all Cron functions. This can be useful to ensure you’re getting the absolute latest data reflected across your Moodle site, especially after making significant changes or when troubleshooting.
How to Run Cron Manually
Running Cron manually is quite simple if you have administrator access. Here’s how:
1. Adjust Security Settings
By default, Moodle is set to run Cron only from the command line for security reasons. To enable browser-based execution, you need to change this setting:
- Navigate to Site administration.
- Scroll down to Security and select Site security settings.
- Scroll down until you find the line that says Cron execution for command line only.
- Change this setting from Yes to No. This allows you to run Cron from your browser.
- While you’re here, it’s highly recommended to set a password for Cron execution to enhance security.
Once you’ve made these changes, scroll to the bottom of the page and click Save Changes.
2. Execute Cron from Your Browser
After saving your changes, you’ll need to construct a specific URL to trigger Cron.
- Locate the admin Cron password you just set.
- Append the following to your Moodle site’s base URL: /admin/cron.php?password=YOUR_CRON_PASSWORD.
- Replace “YOUR_CRON_PASSWORD” with the actual password you created.
For example, if your Moodle URL is https://yourmoodlesite.com, the Cron URL would look something like: https://yourmoodlesite.com/admin/cron.php?password=YourSecurePasswordHere.
When you press Enter, you will see a collection of tasks run. These are all the Cron tasks that Moodle is executing or needed to execute. It’s a good practice to run Cron at least once, perhaps even two or three times, to ensure all tasks are fully processed.
Conclusion
That’s how you manually run your Cron tasks in Moodle. If you’re interested in learning more about essential Moodle admin tasks, such as clearing cache, setting tasks, turning on debugging, reading log files, editing config, running automated backups, checking performance overviews, security reports, and using ad-hoc database queries, be sure to check out more of our videos on making the most out of the Moodle learning management system.