A scheduled script launch through Cron is available on our servers. You need to enter the server console through SSH and execute the command to set it.

crontab -e

Editor Nano will open, where you need to put the cursor on the last line and write your command in this format

Minute    Hour    Day    Month    Weekday    Command

Saving – Ctrl+O, exit through Ctrl+X. If you exit without saving, the editor will ask you whether to save this file or not. Answer with the buttons Y or N.

For example, daily execution of test.php file from your directory root, every 10 minutes it will look like this:

*/10    *    *        *        *            php ~/test.php

Symbol ~ in GNU/Linux – it is the link to your home directory

The script is executed from the name of your user, so he has an access to the same files and directories as running through a browser.

Also you could specify your email to send messages about the work of your scripts. Just set at the beginning:

MAILTO=your@email.com

Minute    Hour    Day    Month    Weekday    Command

You can use this php file to work in MODX console regime:

<?php
// Initiate the console mode
define('MODX_API_MODE', true);
// The file itself is located in a home directory, and MODX against it - in www
require 'www/index.php';

// Initiate the necessary MODX services
$modx->getService('error','error.modError');
$modx->setLogLevel(modX::LOG_LEVEL_ERROR);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');

// Then any your further operation with $modx object

Remember that work with task schedule is the number of commands to the server. It means that if your website is transferred to another server, your list is not copied there. You will have to launch crontab –e on another server and create your tasks from the start.