Gyre Services ®

Technology Blog

Setup Moodle Cron with Windows Task Scheduler

In this guide I will show you how to setup a moodle cron task using the Windows Task Scheduler, you can use this for many other cron jobs as well.

Note: This is assuming that you have php installed and configured on your server.

Check your PHP environment settings

Check_your_PHP_environment_settings.png

1. Right click Computer
2. Click properties

Access "Advanced system settings"

Access_Advanced_system_settings.png

Open "Environment Variables..."

Open_Environment_Variables....png

Edit Path variable

Edit_Path_variable.png

1. Click and select "Path"

2. Click "Edit"

media_1303628409298.png

1. Verify that the path to your PHP installation folder is listed, if not add it.

2. Click ok and close

Check status of Moodle Cron

Check_status_of_Moodle_Cron.png
media_1303631184323.png

This indicates that Moodle cron hasn't run for at least 24 hours meaning that cron was not configured

Open Task Scheduler

Open_Task_Scheduler.png

1. Click Start

2. Click "Administrative Tools"

3. Click "Task Scheduler"

Access the Task Scheduler Library

Access_the_Task_Scheduler_Library.png

Click the "Task Scheduler Library"

Create Task

Create_Task.png

Click "Create Task" un the action pane of the "Task Scheduler Library"

Configure General Task options

Configure_General_Task_options.png

1. Enter name of the task

2. Enter Description of the Task

3. Select "run whether user is logged on or not"

4. Check "Run with the highest privileges"

3. Check "Hidden" to reduce the likelihood of this task being accidentally deleted

Add task Trigger

Add_task_Trigger.png

1. Click the "Trigger" tab

2. Click "New" to add the trigger

Configure Trigger settings/options

Configure_Trigger_settingsoptions.png

1. Select "Daily"

2. Check "Repeat task every and choose 15 minutes"

3. Click OK

Add task Action

Add_task_Action.png

1. Click the "Actions" tab

2. Click "New"

Configure Action settings/options

Configure_Action_settingsoptions.png

1. Enter "php" in the "Program/script" field

2. Enter "-q" followed by the file path to your Moodle cron.php

Verify and close task

Verify_and_close_Task.png

1. Verify the "Action" and "Details"

2. Click ok to create task

Run task for the first time

Run_task_for_the_first_time.png

1. Select the "Moodle Cron" task

2. Click "Run" under the actions pane for the "Moodle Cron" task

Thats it you are done!