Categories

(83)
(69)
(8)
(34)
(74)
(149)

Elysiacron – "crontab-like" expansion of cron possibilities

02.03.2011
Elysiacron –
Author:

While Drupal website development company creating sites, cron.php script is used to perform search function (content indexation), to e-mail subscribers, gather rss-feeds, have the “ancient” statistics deleted and so on. The modules on their own are capable of setting the tasks and scheduling them.

There is a good number of modules on drupal.org that can facilitate, in one way or another, the interaction with the cron script. The most popular among them being: SuperCron and Poormanscron. The former provides sufficient set of settings for scheduling cornstalks and their automation and holds much promise thereby. The latter is notable for its cron.php script launch interval.  Elysia cron is, to my mind,  the best in use as much as the most correct. Because of its exclusive flexibility and usability, this module knocks its competitors socks off. It is also notable for having API, unix-crontab syntaxis configuring feature (which insures that the time be set separately for each task).

The module's advantages are as follows:

  • advanced planning of other modules cron-procedures, as done for each one separately (“difficult” tasks will be attended at longer intervals, and the “easier” ones - more frequently);
  • you are free to turn off certain procedures in case they are not needed;
  • forced launching for specific cron-procedures;
  • capacity for performing group (channel) creation procedures;
  • user-friendly interface;
  • cron-task creation directly from user interface;
  • considerable increase in efficiency

Those mentioned above are just a few great things about this module. You can learn more about it on the module page https://www.drupal.org/project/elysia_cron

By default, Elysia cron is performing the tasks sequentially (in one channel), once in an hour. This practice can be changed by referring to admin/build/cron/settings page.

In case of the standard installation, Elysia cron will be activated via standard drupalcron.php launching procedure. But this might cause problems affecting further productivity (e.g. cache management for variables (from variable table)). So as the problems could be avoided and the operating speed improved, one can replace cron.php file (it is in site root) with the same file from Elysia cron module folder. Mind that, in this case, you should skip upgrading the cron script while Drupal is being upgraded. The cron module can also be activated straight from the cron-tab.

This module has easy API which allows:

  • assigning more than one task in the module;
  • assigning different rules of planning for each procedure;
  • adding description of a procedure.

It’s necessary to activate hook_cronapi:

function module_cronapi($op, $job = NULL) { 
  ... 
} 

Alterable $op takes three values:

  1. “list” – to define unique procedure identifiers and their description;
  2. “rule” – to define procedure planning rules (execution time);
  3. “execute” – procedure itself.

For example:

function module_cronapi($op, $job = NULL) { 
  switch ($op) { 
    case 'list': 
      return array( 
        'module_process_queue' => 'Process queue of new data',
        'module_send_summary_mail' => 'Send summary of data processed'
      ); 

    case 'rule': 
      if ($job == 'module_process_queue') return '0 * * * *';
      else return '0 1 * * *'; 
    case 'execute': 
      if ($job == 'module_process_queue') { 
        ... do the job ... 
      } 

      // For example, module will be sending e-mails 
      // function (below) 
  } 
} 

  

function module_send_summary_mail() { 
  ... execution procedure code ... 
}

The Elysia cron's API can also support standard cron hooks even without them being identified in hook_cronapi(). Nevertheless, you on your own can define the description and work out the schedule for these procedures:

function module_cronapi($op, $job = NULL) { 
  switch ($op) { 
    case 'list': 
      return array( 
        'module_cron' => 'Standard cron process', 
      ); 

    case 'rule': 
      return '*/15 * * * *'; 
  } 
} 


function module_cron() { 
  ... 
  // This is standard cron's hook 
  // by default it will be executed every 15 minutes 
  ... 
}

In conclusion

Elysia cron module seems to be quite a flexible, universal and extremely useful tool for managing regular procedures on your site. And it exactly is the choice InternetDevels web development company has made!

8 votes, Rating: 5

Read also

1

First of all what is Apache Solr? Apache Solr – is the advanced search platform with open primary code by Apache Lucene project.

2

While developing a real estate site for one of our clients we tried to import the complete world cities database into the taxonomy (that was the client's demand).

3

It’s a very helpful module, which allows inserting FileField right into the text editor. For example, in the process of writing this text an Insert button was pushed and the following image...

4

This kind of mistake can be seen on servers with nginx as frontend and Apache as backend. It’s usually considered to be a nginx problem which is tried to be strenuously solved. Quite often it’s...

5

Facebook Developer Blog published good news: from now on one can get user’s address and cell phone number.

Subscribe to our blog updates