Cron is a system for running scripts or commands on a defined scheduled on the server. Moodle uses it to send out forum emails, delete old files, check for updates on Moodle.org etc. PoodLL uses it to convert audio and video to playable formats in a background task. Whenever you or a student records a video, the next time cron runs, it converts the audio/video and copies it into Moodle. Ideally cron should be run once a minute. Moodle won’t do everything once a minute. It schedules jobs to run at different intervals. Read more about Moodle cron here.


To run the Moodle cron script manually, the command that needs to be run is:

[path/to/php] [path/to/moodle/admin/cli/cron.php] >/dev/null


so it might look like this on a typical server:

/usr/bin/php /var/www/moodle/admin/cli/cron.php >/dev/null


But that is just the command. You need to schedule it to run each minute ideally. And thats the cron part of things. You can do that via:

  •  cPanel
    OR
  • command line.


Using cPanel

From the cPanel’s “advanced” section choose “cron jobs” and add the job with the command there. Like this:


Using command line

 

From the command line you open the file that contains all the cron jobs, using the cron job editor thingy. If it is the first time you might be asked which command line editor to use. Nano is the easiest. [good luck]


Ideally you will run crontab as the web server user. In that case this command will usually be correct

sudo crontab -u www-data -e


and add something like this:

* * * * * /usr/bin/php /var/www/moodle/admin/cli/cron.php >/dev/null

After you save it, the cron tasks will be reloaded and your cron job should run … hopefully.