Gettting crontab right for Moodle 2.7 running on CentOS 6.5 Linux server

Gettting crontab right for Moodle 2.7 running on CentOS 6.5 Linux server

by Gary Lebowitz -
Number of replies: 3

I have just set up Moodle 2.7 on a Linux server running CentOS 6.5. Previously I had a cron job running properly that sent out  alerts out each time a new posting was sent to a discussion forum on my old site. But that was for Moodle 2.4.3 running CentOS 6.4 and with the Plesk 11 GUI. My current Moodle installation is 2.7, and it was installed via the command line, with no Plesk 11 interface, which means changes in the path of the exact command used after /usr/bin/php /var.....  If I open my browser and type:

http://......moodle/admin/cron.php

I see what I should. (See attachment.) The question now is how to know what the exact path is with my OS installed (again, CentOS 6.5) installed via the command line in order to get the command to run by properly editing the crontab file. If anyone happens to have the same configuration as mine with a crontab properly running the cron.php to send out alerts each time there is a new posting in a discussion forum, please let me know. I've tried every path i could think of up till now to ..../cron.php


 

Attachment cron1.jpg
Average of ratings: -
In reply to Gary Lebowitz

Re: Gettting crontab right for Moodle 2.7 running on CentOS 6.5 Linux server

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Maybe this will help.

http://docs.moodle.org/27/en/Cron

Average of ratings: Useful (1)
In reply to Rick Jerz

Re: Gettting crontab right for Moodle 2.7 running on CentOS 6.5 Linux server

by Gary Lebowitz -

Hi Rick,

Thanks for you tip. I tried it on the command line and found it to work. smile I also tried using the Web version of the command in my browser and it worked, too. smile Then I started thinking. Harder this time than before posting my request. And I soon started to suspect I might have yum-installed the wrong version of crond for CentOS 6.5. So I hunted around a little more than before and discovered the right package to install: cronie for CentOS 6.x and not the one that had seemed to install OK (at least that's what the install message said) but that wasn't the right one it turned out. 

To share my the-hard-way experience,  be it known that my correct (it turns out) entry in the crontab after yum-installing cronie for crond for a CentOS 6.5 server like mine is simply:

/usr/bin/php /var/www/html/moodle27/moodle/admin/cli/cron.php

Of course, this presupposes that cronie has been installed on the CentOS 6.5 machine and not something that looks like a duck and walks like a duck, but isn't a duck after all. wink



In reply to Gary Lebowitz

Re: Gettting crontab right for Moodle 2.7 running on CentOS 6.5 Linux server

by Dan Bennett -

If you're connected to SSH, head to the area where the cron.php is (within /admin/cli - don't run the web version) then type 'pwd'.

This will show the direct path to the directory you are in.

Then it's just a case of adding "cron.php" to the end of that in crontab. (crontab -e)