Is it possible to run drush cron over a single module, something similar to "drush cron my_module"?
3 Answers
You can do
drush php-eval 'my_module_cron();'
and it should run.
-
-
@Randell If would be the custom hook_cron() that you have defined in my_module.– mpdonadio ♦Mar 28, 2014 at 1:05
-
Thanks @MPD! Can I replace it with 'some_nonhook_function()' if I'm using Elysia cron?– RandellMar 28, 2014 at 1:09
-
@Randell You can use php-eval to call / execute anything. I do it all the time to test things.– mpdonadio ♦Mar 28, 2014 at 3:12
-
Note though that whatever function you call may not have the proper variables in scope if it's not a cron function. I think hook_cron() implementations, on the other hand, should be self-contained. Dec 8, 2016 at 18:23
I think you can just use,
drush cron module_name
-
1Can you confirm which version of drush this works in? I just looked at core.drush.inc in the version from PEAR, and I am not seeing arguments for that command.– mpdonadio ♦Oct 4, 2012 at 12:55
-
-
3
You can implement your own drush commands. Have look at the sandwich example code in the drush source package.