We have scheduled cron job at morning 8am and afternoon 12 pm but the afternoon job ran with morning.

Below is the code which I'm using issue is overnight job ran on time and ran with morning .

function hook_modulename_cronapi()
{
$items = array();
/* Client Daily report Start here*/
$items['test_overnight'] = array(
'title' => t('Overnight Report 8-AM'),
'file' => 'overnight.jobs.inc',
'file path' => drupal_get_path('module', 'test_modules') . '/cron',
'callback' => 'overnight_report',
'callback arguments' => array(),
'enabled' => TRUE,
'scheduler' => array(
'name' => 'crontab',
'crontab' => array(
'rules' => array('2 8 * * *'),
),
),
'launcher' => array(
'name' => 'serial',
'serial' => array(
'thread' => 'any',
),
),
);

$items['test_morning'] = array(
'title' => t('Morning Report 8AM-noon'),
'file' => 'morning.jobs.inc',
'file path' => drupal_get_path('module', 'test_modules') . '/cron',
'callback' => 'morning_report',
'callback arguments' =>array(),
'enabled' => TRUE,
'scheduler' => array(
'name' => 'crontab',
'crontab' => array(
'rules' => array('5 12 * * *'),
),
),
'launcher' => array(
'name' => 'serial',
'serial' => array(
'thread' => 'any',
),
),
);

return $items ;
}

Please suggest solution for this very important for us please help us.

Thanks in advance.

Comments

vipul tulse created an issue. See original summary.

vipul tulse’s picture

Priority: Normal » Major
Issue summary: View changes
arnested’s picture

Status: Active » Closed (duplicate)
Related issues: +#2891188: Cron Job run with other schaduled crons

Closing this. It is a duplicate of the issue you created two days ago: https://www.drupal.org/node/2891188.