tripal_daemon.drush.inc 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * @file
  4. * Implementation of the Tripal Daemon Drush commands
  5. */
  6. /**
  7. * Implements hook_drush_help().
  8. */
  9. function tripal_daemon_drush_help($command) {
  10. switch ($command) {
  11. case 'drush:tripal-jobs-daemon':
  12. return dt('Use Tripal Jobs Deamon to manage Tripal Job execution.');
  13. }
  14. }
  15. /**
  16. * Implements hook_drush_command().
  17. */
  18. function tripal_daemon_drush_command() {
  19. $items = array();
  20. $items['tripal-jobs-daemon'] = array(
  21. 'description' => dt('Use Tripal Jobs Deamon to manage Tripal Job execution.'),
  22. 'arguments' => array(
  23. 'start' => 'Start the daemon.',
  24. 'status' => 'Display status information about the daemon.',
  25. 'stop' => 'Stop the daemon.',
  26. 'restart' => 'Restart the daemon',
  27. 'show-log' => 'Show the log file.',
  28. ),
  29. 'options' => array(
  30. //'--feedback' => 'Frequency of progress messages, in seconds or items processed.',
  31. ),
  32. 'examples' => array(
  33. 'drush trpjob-daemon start' => 'Start the daemon.',
  34. //'drush trpjob-daemon start --feedback="100 items"' => 'Log a status message every 100 nodes.',
  35. //'drush trpjob-daemon start --feedback="60 seconds"' => 'Log a status message every 60 seconds.',
  36. //'drush trpjob-daemon start --verbose' => 'Log verbosely.',
  37. ' ' => '',
  38. 'drush trpjob-daemon status' => 'Show the current status of the daemon.',
  39. ' ' => '',
  40. 'drush trpjob-daemon stop' => 'Stop the daemon, allowing 45 seconds for processing.',
  41. //'drush trpjob-daemon stop --timeout=10' => 'Allow 10 seconds for processing.',
  42. //'drush trpjob-daemon stop --queue' => 'Queue the node access rebuild daemon to stop.',
  43. ' ' => '',
  44. 'drush trpjob-daemon restart' => 'Restart the daemon, allowing 45 seconds for processing.',
  45. //'drush trpjob-daemon restart --timeout=10' => 'Allow 10 seconds for processing.',
  46. //'drush trpjob-daemon restart --queue' => 'Queue the node access rebuild daemon to restart.',
  47. ' ' => '',
  48. 'drush trpjob-daemon show-log' => 'Show the log file, using less.',
  49. //'drush trpjob-daemon show-log --watch' => 'Watch the log file.',
  50. //'drush trpjob-daemon show-log --tail' => 'Show just the tail of the log file, to see recent messages.',
  51. ),
  52. 'aliases' => array('trpjob-daemon'),
  53. );
  54. return $items;
  55. }
  56. /**
  57. * Drush Command for Daemonized management of Tripal Jobs
  58. *
  59. * @param $action
  60. * One of 'start','stop','restart',status','show-log'. Meant to indicate what you want
  61. * the daemon to do.
  62. */
  63. function drush_tripal_daemon_tripal_jobs_daemon($action) {
  64. drush_print("\nTripal Jobs Daemon\n".str_repeat("=",60)."\n");
  65. drush_print(" You have choosen to $action the daemon.\n");
  66. }