tripal_daemon.drush.inc 2.7 KB

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