Cannot get admin/cli/cron.php to run

Cannot get admin/cli/cron.php to run

by Robert Wilson -
Number of replies: 4

I have really struggled with what should be a simple cron job. I've verified the path and the logs show that the corn for cron.php is running every minute - no errors displayed, yet the system tells me that the script has never been run. Any ideas on where I should look? Running CentOs 7.0 with CWP Web panel Pro. Thanks in advance for any help...

Average of ratings: -
In reply to Robert Wilson

Re: Cannot get admin/cli/cron.php to run

by Ken Task -
Picture of Particularly helpful Moodlers
Is this really a developer question?

If you followed directions in moodle docs to setup the cron job, the > at the end sends output into la-la-land. One doesn't reallly now if it's running or not ... or what job might be failing for some reason.

Thus, propose a change that Randy Thorton shared some time ago. Redirect to a log file that is constantly overwritten (thus doesn't get large).

touch /var/log/moodle-cron.log

Then in cron job setup, redirect > /var/log/moodle-cron.log

Can then watch that log in realtime:
tail -f /var/log/moodle-cron.log

For setup with your panel, see:

'SoS', Ken
Average of ratings: Useful (1)
In reply to Ken Task

Re: Cannot get admin/cli/cron.php to run

by Michael Milette -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Good suggestion Ken!

Here are a few more suggestions:

In Moodle, navigate to Site Administration > Notifications and make sure that there are no pending updates. Pending updates can prevent cron from running.

From a terminal shell prompt, change into your moodle directory and run:

php admin/cli/cron.php

If you don't have access to the shell, you could enable remote access to cron in Moodle and then run it from a url. Example:

www.yoursite.com/admin/cron.php

Don't forget to turn access off after you're done testing for security reasons.

Make sure that you are running crontab under same user as your web server. Otherwise you could be creating permissions issues.

Hope you find this helpful.

Best regards, 

Michael Milette

In reply to Ken Task

Re: Cannot get admin/cli/cron.php to run

by Robert Wilson -
Thank you for your help - I've got it running now. Apologize for hitting the wrong forum. Moodle Newbie here....