Running individual cron jobs with Drush
Can I run separate cron jobs with Drush? for example I have a cron job named mycron. In Esysia UI, I can run this 1 job by clicking [run].
In drush I can use the "drush elysia-cron" command, but this will start all active cron jobs.
My question is, how can I run mycron (only) via drush?
Request: make all cron jobs available in drush so that "drush elysia-cron mycron" will work.
source to share
Here's how I evaluate my own cron hook.
1) Find a suitable hook_cron call in your module. modulename_cron is what you want.
2) Find out if any specific variables are affected when you run it. In my case, there is a variable modulename_cron_last that keeps track of the last cron run. I have to force this to 0 to make it work.
3) Run drush:
drush eval "variable_set('modulename_cron_last', 0);"
drush eval "modulename_cron();"
drush eval "variable_set('modulename_cron_last', time());"
OR
If you are using DEV version 2.x for D7, this is possible with the command:
drush elysia-cron run [JOB_NAME]
or:
drush elysia-cron run [JOB_NAME] --ignore-time
(use --ignore-time to force execution)
4) Make a script and add it to your scheduler (in my case, a local Linux crontab)
source to share