-

Note: You are currently viewing documentation for Moodle 3.10. Up-to-date documentation for the latest stable version of Moodle may be available here: Moodletxt cron.

Moodletxt cron

From MoodleDocs

MoodleTxt Updates Via Cron

What is cron?

Cron job
The term generally used (in Unix circles) to refer to a user-defined script or program that is automatically run at regular intervals.


MoodleTxt can optionally use a cron job to fetch regular updates from the ConnectTxt server, including new inbound messages, and status updates for previously sent messages.

Why use cron?

The recommended method of acquiring updates from the ConnectTxt system is XML Push. However, this requires an inbound connection to your Moodle server. If you cannot configure this connection, but still wish to receive updates from the ConnectTxt system automatically, then you can use MoodleTxt's local cron job to automatically poll the ConnectTxt system for updates at regular intervals. This is much more efficient than the default update settings (where checks are made when certain pages are loaded) and will result in a performance increase for MoodleTxt.

Automatic Setup

As of MoodleTxt 2.4, this cron script automatically adds itself to the main Moodle maintenance script, so if you already have this running at short, regular intervals, no action is required to enable cron – MoodleTxt will automatically fetch inbound messages and status updates every time the Moodle maintenance script runs.

Custom Setup

If your Moodle maintenance script is not enabled, or does not run often enough for MoodleTxt use, you can still use cron to fetch message details. MoodleTxt provides a script that is another entry point to the cron system, which you can set to run at shorter intervals separate from the Moodle maintenance script. The path to this script is “/blocks/moodletxt/cron.php”, under your main Moodle installation directory. For example, if you have Moodle installed on Linux at:

/srv/www/moodle/

Then the path to the cron script would be:

/srv/www/moodle/blocks/moodletxt/cron.php

By specifying this file to be run in your chosen scheduling software, at an interval of your choosing, you can emulate the efficiency of the XML Push service without changing your security configuration.

Steps to Take After Setup

Once you have configured cron according to your needs, it is wise to turn off the per-request updates from the MoodleTxt Settings page. (These are the Get_Status_On_View and Get_Inbound_On_View settings.) These will no longer be needed, and you will gain a performance boost by disabling them.

View all MoodleTxt documentation