1

I have two cron jobs in my site (I'm using Elysia Cron). They are set in my own module. One runs every minute and one every hour. Code below:

function mymodule_cronapi($op, $job = NULL) {
    $items['Import J Data'] = array(
        'description' => 'Import J Data',
        'rule' => '* * * * *',
        'callback' => 'mymodule_import_j_data_cron',
    );
    $items['Import Q Data'] = array(
        'description' => 'Import Q Data',
        'rule' => '0 * * * *',
        'callback' => 'mymodule_import_q_data_cron',
    );
    return $items;
}

function mymodule_import_j_data_cron($what) {   
    mymodule_j_save_f_data();
    mymodule_j_save_c_data();
}

function mymodule_import_q_data_cron($what) {
    mymodule_q_save_data();
}

In my server (centOS), i have the following line in my crontab (with correct MYKEY and url):

* * * * * root wget -O - -q -t 1 http://.../cron.php?cron_key=[MYKEY] >/dev/null 2>&1

When the second job runs (the one set to run every hour), the other one stops and I get the following error in my site log:

Attempting to re-run cron while it is already running.

The firs job runs for about 15-20 minute. After it ends, the other one starts again.

My question is, it's not possible to have both cron jobs running at the same time? Am I missing some settings in elysia cron?

1

It looks like ultimate cron can run parallel jobs.

  • Thanks cilefen. I installed Ultimate Cron and it seems better than Elysia but I still can't get the "every minute" job to run when the other one is also running and I can't find nothing on the API on how to configure this. – zephirus Dec 8 '15 at 17:16
  • UPDATE: I managed to do it. There are settings inside drupal cron page. The number of threads were set to 1. Changed that and now the jobs run at the same time. – zephirus Dec 8 '15 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.