Adding Cron Job for Moodle LMS

A common problem we see when performing health checks of our customer’s Moodle based Learning Management System (LMS) sites is the “cron” process not working. This will affect the performance of the LMS. In most cases the cronjob is setup but not running for various reasons. Here is the easiest way to get your cron job working in Moodle.

Although Moodle Documentation suggest usage of CLI, you can use direct URL with password protection. To do this enable this from your Moodle Administrator => Security => Site Policies.You need to uncheck Cron execution via command line only. Then input a password and replace it in the URL below.

moodle cron job

cPanel Based servers (replace with your domain name and password of Moodle setting as image shown above)

Go to cPanel => Cron Jobs

moodle cron job in cpanel

wget -q -O –

Linux based servers

Login to SSH

crontab -e

Add this at the end of page

@hourly wget -q -O –

crontab for Moodle in linux

You can remove # before MAILTO and replace your own email if you wish to receive email alert everytime the cronjob is executed.