SuiteCRM 8 Cron jobs/Schedulers

Howdy, I’ve got another question regarding suite CRM 8.

I am trying to write a custom cron job/scheduler, I’ve got the crontab setup and I can see some default jobs in Admin > Schedulers. However there yet isn’t any SuiteCRM 8 scheduler guide, only for SuiteCRM 7, that says following:

SuiteCRM lets you define your own Scheduler. We do this by creating a file in
custom/Extension/modules/Schedulers/Ext/ScheduledTasks/ .

But that doesn’t seem to do much and also looking at the github repo there is a file named “_AddJobsHere.php” which sounds intriguing. So what is the right way to make a scheduler in SuiteCRM 8 ?

Also a side question if I want to pull data from contacts audit (the timeline that is shown to the side of a contact detail), should I be accessing it with contacts bean and then a relationship to contacts_audit or can I access it more directly ? (I also need to run a query on top of it)

$bean = BeanFactory::getBean('<some_bean>');
// Maybe more code
$query = "contacts_audit.date_created > '$cutOff'";
$contacts = $bean->get_full_list('', $query);

Well I made it to the scheduler list by extending the _AddJobsHere.php file with a custom function and push to $job_strings array

array_push($job_strings, 'exportData');

and I had to make a custom sql query for audit table via $result = $GLOBALS["db"]->query($sql);, not sure if that’s the right way to do it though. I am then fetching the results like so:

while ($row = $GLOBALS["db"]->fetchByAssoc($result)) {
    array_push($array, $row);

However I can’t get the cron jobs to run (other than manually calling php -f cron.php), even though I have a crontab set and it says that cron service is running

Thanks for the details.

This might help you with getting the jobs running: