tripal_daemon.drush.inc 2.8 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. 'num_lines' => 'The number of lines of the log file to show.',
  31. 'deamonize' => 'Pass this option to push the daemon into the background'
  32. ),
  33. 'examples' => array(
  34. 'drush trpjob-daemon start' => 'Start the daemon.',
  35. //'drush trpjob-daemon start --feedback="100 items"' => 'Log a status message every 100 nodes.',
  36. //'drush trpjob-daemon start --feedback="60 seconds"' => 'Log a status message every 60 seconds.',
  37. //'drush trpjob-daemon start --verbose' => 'Log verbosely.',
  38. //' ' => '',
  39. //'drush trpjob-daemon status' => 'Show the current status of the daemon.',
  40. ' ' => '',
  41. 'drush trpjob-daemon stop' => 'Stop the daemon.',
  42. //'drush trpjob-daemon stop --timeout=10' => 'Allow 10 seconds for processing.',
  43. //'drush trpjob-daemon stop --queue' => 'Queue the node access rebuild daemon to stop.',
  44. //' ' => '',
  45. //'drush trpjob-daemon restart' => 'Restart the daemon.',
  46. //'drush trpjob-daemon restart --timeout=10' => 'Allow 10 seconds for processing.',
  47. //'drush trpjob-daemon restart --queue' => 'Queue the node access rebuild daemon to restart.',
  48. //' ' => '',
  49. //'drush trpjob-daemon show-log' => 'Show the log file, using less.',
  50. //'drush trpjob-daemon show-log --watch' => 'Watch the log file.',
  51. //'drush trpjob-daemon show-log --tail' => 'Show just the tail of the log file, to see recent messages.',
  52. ),
  53. 'aliases' => array('trpjob-daemon'),
  54. );
  55. return $items;
  56. }
  57. /**
  58. * Drush Command for Daemonized management of Tripal Jobs.
  59. * Simply plugs into the Daemon API for easier running. This is the equivalent of
  60. * drush jobs-daemon $action tripal_daemon
  61. *
  62. * @param $action
  63. * One of 'start','stop','restart',status','show-log'. Meant to indicate what you want
  64. * the daemon to do.
  65. */
  66. function drush_tripal_daemon_tripal_jobs_daemon($action) {
  67. drush_daemon_api_jobs_daemon($action, 'tripal_daemon');
  68. }