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 mysite.com 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 – http://mysite.com/admin/cron.php?password=sams

Linux based servers

Login to SSH

crontab -e

Add this at the end of page

@hourly wget -q -O – http://mysite.com/admin/cron.php?password=sams

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.