'string', 'rule' => 'string', 'weight' => 1234, 'callback' => 'function_name', 'arguments' => array('first', 'second', 3), // External file, like in hook_menu. 'file' => 'string', 'file path' => 'string', ); // Run function example_sendmail_cron() every 2 hours. // Note: i don't need to define a callback, i'll use "example_sendmail_cron" // function. $items['example_sendmail_cron'] = array( 'description' => 'Send mail with news', 'rule' => '0 */2 * * *', ); // Run example_news_fetch('all') every 5 minutes. // Note: this function has argument. $items['example_news_cron'] = array( 'description' => 'Send mail with news', 'rule' => '*/5 * * * *', 'callback' => 'example_news_fetch', 'arguments' => array('all'), ); // Definition of rules list and embedded code. if ($op == 'list') { // Rules list. $items['job1'] = array( 'description' => 'Send mail with news', 'rule' => '0 */2 * * *', ); $items['job2'] = array( 'description' => 'Send mail with news', 'rule' => '*/5 * * * *', ); } elseif ($op == 'execute') { // Embedded code. switch ($job) { case 'job1': // ... job1 code. break; case 'job2': // ... job2 code. break; } } return $items; } /** * Altering hook_cron definition. * * You can use the "hook_cron_alter" function to edit cronapi data of other * modules. * * @param array $data * Array of cron rules. */ function hook_cron_alter(&$data) { $data['key']['rule'] = '0 */6 * * *'; } /** * @} End of "addtogroup hooks". */