cialis buy levitra online buy xenical online

Moodle Cron Workaround

Posted by: rkassissieh
July282005

Moodle has a cron.php script that takes care of routine tasks, such as unsubscribing inactive members from classes and sending out email messages. Unfortunately, there is no built-in way for this script to run every few minutes when the Moodle installation is inside a protected directory, such as a school Intranet. However, I figured out a workaround.

If you have directory security enabled on your IIS Moodle installation, don't use MoodleCron. Instead create a Windows Scheduled Task on your server. This passes credentials and executes the cron.php script from the command line, getting around nasty browser authentication issues.

1. Open Control Panel --> Scheduled Tasks on your server
2. Open Add Scheduled Task. Select Next.
3. When asked to select an application, Browse to your PHP installation and select PHP.exe. Select Next.
4. Create a name for the task (I called mine "Moodle cron")
5. Perform this task "daily." Select Next.
6. Perform this task "every day" (leave the other items on defaults). Select Next.
7. Enter the name and password of a user who has directory privileges on your /moodle/admin folder. Select Next.
8. Select "Open advanced properties for this task when I click Finish." Select Finish.
9. Under the Task tab, append the location of cron.php to the Run field, e.g. c:\php\php.exe d:\webroot\moodle\admin\cron.php
10. Under the Schedule tab, click Advanced and then select Repeat Task in order to make the task run more often than once per day. I set mine to run every ten minutes. Select Apply.
11. Select OK. You're done! Check the Event log later to ensure that the script is not returning errors.
« Prev item - Next item »
-------------------

Comments

Posted by dan on April 17 - 20:20:30

ive been reading your blog for a few months now, and as a fellow educator, you've helped avoid some costly mistakes! thank you so much for this blog !

Posted by rkassissieh on April 17 - 21:02:00

Thanks, Dan. I always appreciate knowing who is out there and what might be helpful.

Posted by Rory Allford on June 30 - 08:49:21

I'd recommend running the scheduled task under the built-in IUSR_[Something] or a manually created unprivileged account, for security reasons, in case the cron script is somehow compromised. See discussion at http://moodle.org/mod/forum...

Posted by rkassissieh on June 30 - 22:12:52

Yes, I suppose so. I don't know the details of how Windows stores its scripts and how vulnerable this might be.

Posted by Paul Raper (Switzerland) on July 20 - 23:50:29

Does this only work if Moodle is installed on a "local" machine? My version of Moodle is installed on an a machine run by my ISP, so I take it this proceedure won't work.

Posted by rkassissieh on July 21 - 07:20:22

Most ISPs have steps you can follow or an admin panel you may use to set up a cron job on your site.

Leave comment




Subscribe comments

Enter email address to subscribe to comment on this item
Click here to manage subscription