Khin Moh Moh Thein
Khin Moh Moh Thein

Reputation: 25

How to run the module web page every 15 min in Moodle with cron job

In my moodle site, I want to send the notification email to the student before their assignment overdue. I put these code are written in mymodule/cron.php page. I want to call mymodule/cron.php in every 15 mins.But I don't know how to set up the cron in moodle.If anyone know how to run the cron in moodle, please let me know.

Thanks in advance!

Upvotes: 0

Views: 436

Answers (1)

Russell England
Russell England

Reputation: 10221

Assuming the moodle cron is set up - http://docs.moodle.org/26/en/Cron

Then in /local/mymodule/version.php you should have a line that says

$module->cron = 60*15; // Number of seconds, so 15*60 = 15 minutes.

This will then run your cron every 15 minutes.

You should also use lib.php for the cron rather than cron.php (assuming its Moodle 2.x)

eg in /local/mymodule/lib.php

function local_mymodule_cron() {
    // Code here
}

Upvotes: 1

Related Questions