Moodle 2.7.5 on Bluehost shared hosting - cron job help

Moodle 2.7.5 on Bluehost shared hosting - cron job help

על ידי Ryan B בתאריך
מספר תגובות: 9

Hi all, I've been running Moodle on bluehost shared hosting for a while. I have both a 1.9 installation that I am still using for some classes, but we have been experimenting with 2.7 for some time with limited classes, just to work out the bugs.

I have no problems with 1.9, but on 2.7, I cannot get cron jobs to work.

I've read the Moodle cron page, I've read the Bluehost cron page, and I've tried using the line from the admin/cron.php file - all to no luck. No matter what script I use, I always get the "The cron.php maintenance script has not been run for at least 24 hours." warning in Moodle.

Yes, I know I can run it manually from the Moodle notifications page, but I would really like to automate it to ensure that the files stay up to date and tasks are performed, especially in regards to email registration.

What I'm currently using (as recommended in the cron.php file):

wget -q -O /dev/null 'http://www.mydomain.com/admin/cron.php?password=MyPass'

Any help?

ממוצע דרוגים: -
בתגובה ל: Ryan B

Re: Moodle 2.7.5 on Bluehost shared hosting - cron job help

על ידי Rick Jerz בתאריך
תמונה של Particularly helpful Moodlers תמונה של Testers

I have never used a password at the end of this wget line.

Might you be able to provide your cron wording for both versions (1.9 and 2.7), so that we can compare?

My cron job looks like this:

/usr/bin/wget -O - -q "http://mydomain.com/moodle/admin/cron.php" > /dev/null 2>&1    

בתגובה ל: Rick Jerz

Re: Moodle 2.7.5 on Bluehost shared hosting - cron job help

על ידי Ryan B בתאריך

My Moodle 1.9 cron (same server, different directory) uses this and runs just fine:

/usr/php/54/usr/bin/php -c /home/username/public_html/php.ini /home/username/public_html/servername/moodle19/admin/cron.php >/dev/null

However, this does not work for 2.7. Not sure why.

I will try your line and report back in a a few days to see if it has been working.

בתגובה ל: Ryan B

Re: Moodle 2.7.5 on Bluehost shared hosting - cron job help

על ידי Floyd Saner בתאריך

My Bluehost cron command is:

/usr/php/54/usr/bin/php /home/<my_account_name>/public_html/moodle/admin/cli/cron.php >/dev/null 2>&1

בתגובה ל: Floyd Saner

Re: Moodle 2.7.5 on Bluehost shared hosting - cron job help

על ידי Ryan B בתאריך
Sorry, I thought it was working, but I am now getting the warning again that cron.php has not been run for at least 24 hours.

Ugh. Not sure what's going on. Maybe I need to contact Bluehost Support to get this figured out.
בתגובה ל: Ryan B

Re: Moodle 2.7.5 on Bluehost shared hosting - cron job help

על ידי Rick Jerz בתאריך
תמונה של Particularly helpful Moodlers תמונה של Testers

I just tried making a forum post on my experimental Bluehost Moodle 2.7 installation, and my cron worked.  I used:

/usr/bin/wget -O - -q "http://www.domainname.com/moodle27/admin/cron.php" > /dev/null 2>&1

בתגובה ל: Rick Jerz

Re: Moodle 2.7.5 on Bluehost shared hosting - cron job help

על ידי Ryan B בתאריך

Tried this; still didn't work. I'm not sure if it is a cron problem.

May I ask how you have the email settings configured? On my Moodle 1.9 installation, I left them blank and let the default php handle it, which works well. Maybe that doesn't work for Moodle 2.7.

I will note that My Moodle 1.9 and Moodle 2.7 are on the same server and differ only in the directory.

Moodle 1.9 - home/username/server/moodle19/...

Moodle 2.7 - home/username/server/moodle/...

I'm still not sure why cron and email work perfectly fine on Moodle 1.9 but do not work on Moodle 2.7. Perhaps I should try a clean install?

בתגובה ל: Ryan B

Re: Moodle 2.7.5 on Bluehost shared hosting - cron job help

על ידי Adam Jenkins בתאריך
תמונה של Particularly helpful Moodlers תמונה של Plugin developers
Hi Ryan,

The command you were using:
wget -q -O /dev/null 'http://www.mydomain.com/admin/cron.php?password=MyPass'
should work so long as it is setup correctly as a cron job. You can test whether or not it will work by running cron in your web browser. Simply copy the cron link http://www.mydomain.com/admin/cron.php?password=MyPass into the address bar of your browser. So long as the output gives you somthing like this at the end:

Cron script completed correctly
Cron completed at 13:54:51. Memory used 38MB.
Execution took 0.337194 seconds
you can be sure that cron.php in your moodle is working fine!

Now, the cronjob where you set the command: wget -q -O /dev/null 'http://www.mydomain.com/admin/cron.php?password=MyPass'
That may need a bit of work. Typically, the whole line of this cronjob should be prefaced with the times that you want the job to be executed:

*/5 * * * * wget -q -O /dev/null http://www.mydomain.com/admin/cron.php?password=MyPass

Here, the */5 * * * * part means "Run every 5 minutes". Note that this need not be on the same server as the moodle. This could be on any computer on the internet.
---------------------------------------------------------------------

Regarding email: SENDING
My recommendation is to make sure that sendmail is installed on your server, and just let Moodle do it's thing automagically. Not that in Moodle the emails are sent as part of the cronjob so if your cron ain't working, no email will be sent.

Regarding email: INCOMING (New feature in 2.8)
Yeah, I'm having trouble getting this working too. Any ideas?

Hope this helps!
בתגובה ל: Adam Jenkins

Re: Moodle 2.7.5 on Bluehost shared hosting - cron job help

על ידי Ryan B בתאריך

I seem to have gotten it working using this:

/usr/php/54/usr/bin/php -c /home/username/public_html/php.ini /home4/username/public_html/servername/moodle/admin/cli/cron.php


This differs from my 1.9 cron job in that I had to add the /cli/ to the directory. It wouldn't run from admin/cron.php.


Everything appears to be working now. Thanks!