Setting up a cronjob for Moodle on a CentOS server when you have limited Linux experience can be rather daunting. I still don’t know to much, but the little I know, I’ll share.
To set up the cronjob for Moodle, I used the following command:
sudo crontab -e apache -u
My task – set to run every 15 minutes for now.
*/15 * * * * /usr/bin/php /var/www/elearning/admin/cli/cron.php >/dev/null
To save and quit the editor, sue the following command:
:wq (colon w q)
Once that’s all set up and saved, you can use the following command to check that it’s there:
sudo crontab -u apache -l
One last little nugget I’ll share with you, is the viewing of the cron file to verify that the cronjob has run.
The file is located in /var/log and the file is called cron
To view the file:
sudo cat cron
To exit the file, simply press q