Moodle cron job failing

  • Answered
I have been unable to get my daily cron job for a Moodle installation working. I need to call this script each night:

Here's the support article from Moodle on how to configure the cron:

I found the recommended wget method is blocked on your system, so I have tried curl, but it hasn't run properly yet. I have tried this a few different ways, and just set it to:
/usr/bin/curl -o /dev/null/ -silent

Should the above work, or do you have a different approach you would suggest?

John Jackson
Hello John, and thank you for your question. We have a guide about how to run a cron job that mentions wget is disabled on all our shared servers, you could instead use the curl command, but need to be sure to define a User-Agent so that it is not blocked by ModSecurity rules on the server. In your case, the final command would need to look something like:
/usr/bin/curl --user-agent cPanel-Cron -o /dev/null/ -silent
Now if you take a look in your website's access-logs, instead of just saying curl/7.15.5 as the User-Agent, it would instead read cPanel-Cron. You can have it say whatever you'd like, just so long as it is defined. Let us know if you had any other questions at all. - Jacob