Let the platform do the work

Creating Custom Jobs

Overview

How to create and execute your own custom jobs.

How it Works

As of 6.3.0, custom job functions can be created using the extension framework. The function for the job will be defined in ./custom/Extension/modules/Schedulers/Ext/ScheduledTasks/. Files in this directory are compiled into ./custom/modules/Schedulers/Ext/ScheduledTasks/scheduledtasks.ext.php and then included for use in ./modules/Schedulers/_AddJobsHere.php.

Creating the Job

Use the section below to introduce the technology in relation to the product and describe its benefits.

This first step is to create your jobs custom key. For this example we will be using 'custom_job' as our job key.

./custom/Extension/modules/Schedulers/Ext/ScheduledTasks/custom_job.php

  <?php

//add the job key to the list of job strings
array_push($job_strings, 'custom_job');

function custom_job()
{
    //custom job code

    //return true for completed
    return true;
}

Next, we will need to define our jobs label string:

./custom/Extension/modules/Schedulers/Ext/Language/en_us.custom_job.php

  <?php

$mod_strings['LBL_CUSTOM_JOB'] = 'Custom Job';

Finally, We will need to navigate to:

Admin / Repair / Quick Repair and Rebuild

Once a Quick Repair and Rebuild has been run, the new job will be available for use when creating new schedulers in:

Admin / Scheduler