tripal_daemon.drush.inc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. 'show-log' => 'Show the log file.',
  27. ),
  28. 'options' => array(
  29. 'num_lines' => 'The number of lines of the log file to show.',
  30. 'child' => array(
  31. 'hidden' => TRUE,
  32. 'description' => 'This option should only be passed via '
  33. . 'drush_invoke_process and essentially just allows my command '
  34. . 'to not fork bomb',
  35. ),
  36. ),
  37. 'examples' => array(
  38. 'drush trpjob-daemon start' => 'Start the daemon.',
  39. 'drush trpjob-daemon status' => 'Show the current status of the daemon.',
  40. 'drush trpjob-daemon stop' => 'Stop the daemon.',
  41. 'drush trpjob-daemon show-log' => 'Show the last 10 lines of the log file.',
  42. 'drush trpjob-daemon show-log --num_lines=50' => 'Show the last 10 lines of the log file.',
  43. ),
  44. 'aliases' => array('trpjob-daemon'),
  45. );
  46. return $items;
  47. }
  48. /**
  49. * Drush Command for Daemonized management of Tripal Jobs.
  50. *
  51. * Simply plugs into the Daemon API for easier running. This is equivalent to
  52. * drush jobs-daemon $action tripal_daemon.
  53. *
  54. * @param string $action
  55. * One of 'start','stop','restart',status','show-log'. Meant to indicate what
  56. * you want the daemon to do.
  57. */
  58. function drush_tripal_daemon_tripal_jobs_daemon($action) {
  59. drush_drushd_daemon($action, 'tripal_daemon');
  60. }