You are here

README.txt in Job Scheduler 6

Same filename and directory in other branches
  1. 8.3 README.txt
  2. 8.2 README.txt
  3. 7.2 README.txt
  4. 7 README.txt
Job Scheduler
=============

Simple API for scheduling tasks once at a predetermined time or periodically at
a fixed interval.


Usage
=====

Add a job.

  $job = array(
    'callback' => 'mymodule_unpublish_nodes',
    'type' => 'story',
    'id' => 12,
    'period' => 3600,
    'periodic' => TRUE,
  );
  job_scheduler()->set($job);

Work off a job

  function mymodule_unpublish_nodes($job) {
    // Do stuff.
  }

Remove a job.

  $job = array(
    'callback' => 'mymodule_unpublish_nodes',
    'type' => 'story',
    'id' => 12,
  );
  job_scheduler()->remove($job);


Drupal Queue integration
========================

If Drupal Queue is installed, tasks are dispatched to the queue rather than
executed. Hence worker callbacks need to be declared to DrupalQueue via
hook_cron_queue_info().


Example
=======

See Feeds module.


Hidden settings
===============

Hidden settings are variables that you can define by adding them to the $conf
array in your settings.php file.


Name:        job_scheduler_class
Default:     'JobScheduler'
Description: The class to use for managing schedule.

Name:        job_schedule_num
Default:     5
Description: The number of jobs to execute on cron time.
             Only has an effect if Drupal Queue is *not* enabled.
             http://drupal.org/project/drupal_queue

Name:        job_schedule_queue_num
Default:     200
Description: The number of jobs to queue for execution on cron time. Only has
             an effect if Drupal Queue is enabled.
             http://drupal.org/project/drupal_queue

File

README.txt
View source
  1. Job Scheduler
  2. =============
  3. Simple API for scheduling tasks once at a predetermined time or periodically at
  4. a fixed interval.
  5. Usage
  6. =====
  7. Add a job.
  8. $job = array(
  9. 'callback' => 'mymodule_unpublish_nodes',
  10. 'type' => 'story',
  11. 'id' => 12,
  12. 'period' => 3600,
  13. 'periodic' => TRUE,
  14. );
  15. job_scheduler()->set($job);
  16. Work off a job
  17. function mymodule_unpublish_nodes($job) {
  18. // Do stuff.
  19. }
  20. Remove a job.
  21. $job = array(
  22. 'callback' => 'mymodule_unpublish_nodes',
  23. 'type' => 'story',
  24. 'id' => 12,
  25. );
  26. job_scheduler()->remove($job);
  27. Drupal Queue integration
  28. ========================
  29. If Drupal Queue is installed, tasks are dispatched to the queue rather than
  30. executed. Hence worker callbacks need to be declared to DrupalQueue via
  31. hook_cron_queue_info().
  32. Example
  33. =======
  34. See Feeds module.
  35. Hidden settings
  36. ===============
  37. Hidden settings are variables that you can define by adding them to the $conf
  38. array in your settings.php file.
  39. Name: job_scheduler_class
  40. Default: 'JobScheduler'
  41. Description: The class to use for managing schedule.
  42. Name: job_schedule_num
  43. Default: 5
  44. Description: The number of jobs to execute on cron time.
  45. Only has an effect if Drupal Queue is *not* enabled.
  46. http://drupal.org/project/drupal_queue
  47. Name: job_schedule_queue_num
  48. Default: 200
  49. Description: The number of jobs to queue for execution on cron time. Only has
  50. an effect if Drupal Queue is enabled.
  51. http://drupal.org/project/drupal_queue