Schedule cron jobs using Ultimate Cron In one of my modules I would like to create two different cron jobs to handle two different procedures. What I did was to use the Ultimate Cron module, and by implementing the cron api, to schedule one of my cron jobs. 

My problem is that in /admin/config/system/cron/jobs only the default from the hook_cron appears and not from the hook_cronapi. This is what I wrote.

/**
 * Implements hook_cron().
 */
function MODULENAME_cron() {
  //code
}

/**
 * Implements hook_cronapi().
 */
function MODULENAME_cronapi() {
  $items = array();

  $items['generate_excel_files'] = array(
    'title' =&gt; 'Table Excel Generate',
    'callback' =&gt; 'generate_excel_files_callback',
    'scheduler' =&gt; array(
      'name' =&gt; 'crontab',
      'crontab' =&gt; array(
        'rules' =&gt; array('0 3 * * *'),
      ),
    ),
  );

  return $items;
}

function generate_excel_files_callback(){
  //code
}
Apparently cron api dosn't work with Drupal 8 at this time. What I did to fix my issue was to create one new module to handle only the cron job that I wanted. Then from the UI of Ultimate Cron I would add the rule to schedule my cron job.

use Drupal\MODULENAME\Controller\ClassName;

/**
 * Implements hook_cron().
 */
function NEW_MODULENAME_cron() {
 generate_excel_files_callback();
}

function generate_excel_files_callback(){
 $obj = new ClassName();
 $obj-&gt;generateXLSX();
}