It would be nice to have a simple Drush task that can be triggered to run the lightweight cron task. Attached patch adds a command for that.

Comments

mikey_p created an issue. See original summary.

mikey_p’s picture

StatusFileSize
new716 bytes
jonathan1055’s picture

This is a nice idea. I have not been able to get Drush working yet on my local server, so I have never used it properly. I really need to get that sorted, then I can test your patch.

jonathan1055’s picture

Have you seen blog tip Replace hook_drush_command by a yaml file?
I wonder if this is now available for us to use, instead of the hook implementation?

jonathan1055’s picture

StatusFileSize
new964 bytes

On second look, Replace hook_drush_command by a yaml file requires the .drush.yml file but it still needs hook_drush_command(). For our small usage it is not worth adding two new files, so sticking with the original scheduler.drush.inc

I have added a message to say that the lightweight cron process has finnished. Then added an option --nomsg to inhibit this message, in the cases where this might be used as part of a larger script.

Just one quesion - is there a reason why you added the file into a new drush folder? It works fine if simply added into the scheduler main directory.

  • jonathan1055 committed 28b036d on 8.x-1.x authored by mikey_p
    Issue #2789515 by mikey_p, jonathan1055: Drush task for lightweight cron
    
jonathan1055’s picture

Status: Needs review » Fixed

I did some research and there is no particular reason or encouragement to have the .drush.inc file in a separate folder, so I left it at the module root folder.

Thanks mikey_p for creating the patch and providing this useful addition.

mikey_p’s picture

Thanks for the update and committing this!

  • jonathan1055 committed acf0a89 on 7.x-1.x
    Issue #2789515 by mikey_p, jonathan1055: Drush task for lightweight cron...
jonathan1055’s picture

Very easy to add the same feature for 7.x. Just changed 'core' => array('7'), and instead of

\Drupal::service('scheduler.manager')->runCron();

it is:

module_load_include('inc', 'scheduler', 'scheduler.cron');
scheduler_cron();

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.