README.txt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. Credits
  2. -------
  3. Thanks to Mark James for the icons
  4. http://www.famfamfam.com/lab/icons/silk/
  5. Example code:
  6. // Default cron-function, configurable through /admin/build/cron/settings
  7. function mymodule_cron() {
  8. // Do some stuff ...
  9. }
  10. // Define custom cron functions
  11. function mymodule_cronapi($op, $job = NULL) {
  12. switch($op) {
  13. case 'list':
  14. return array(
  15. 'mymodule_cronjob_1' => 'Cron-1 Handler',
  16. 'mymodule_cronjob_2' => 'Cron-2 Handler',
  17. 'mymodule_cronjob_3' => 'Cron-3 Handler',
  18. );
  19. case 'rule':
  20. switch($job) {
  21. case 'mymodule_cronjob_1': return '*/13 * * * *';
  22. case 'mymodule_cronjob_2': return '0 0 1 * *';
  23. );
  24. case 'execute':
  25. switch($job) {
  26. case 'mymodule_cronjob_2':
  27. mymodule_somefunction();
  28. break;
  29. }
  30. }
  31. }
  32. // Custom cron-function
  33. function mymodule_cronjob_1() {
  34. // Do some stuff ...
  35. }
  36. // Custom cron-function
  37. function mymodule_somefunction() {
  38. // Do some stuff ...
  39. }
  40. // Custom cron-function
  41. function mymodule_cronjob_3() {
  42. // Do some stuff ...
  43. }
  44. // Easy-hook, uses rule: 0 * * * *
  45. function mymodule_hourly() {
  46. // Do some stuff
  47. }
  48. // Easy-hook, uses rule: 0 0 * * *
  49. function mymodule_daily() {
  50. // Do some stuff
  51. }
  52. // Easy-hook, uses rule: 0 0 * * 1
  53. function mymodule_weekly() {
  54. // Do some stuff
  55. }
  56. // Easy-hook, uses rule: 0 0 1 * *
  57. function mymodule_monthly() {
  58. // Do some stuff
  59. }
  60. // Easy-hook, uses rule: 0 0 1 1 *
  61. function mymodule_yearly() {
  62. // Do some stuff
  63. }