1

Based on this documentation the drush cron can be set up as

10 * * * * /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin COLUMNS=72 /usr/local/drush/drush --root=/path/to/your/drupalroot --uri=your.drupalsite.org --quiet cron

Where is the actual task being set here? I would like to invoke a certain url on each cron run. How do I provide that url to be ran in this cron or invoke a function using this drush cron.

Thanks.

2
  • What do you mean by "run a particular page"?
    – Clive
    Jun 1, 2015 at 14:58
  • Updated to clarify that to invoke a certain url
    – pal4life
    Jun 1, 2015 at 15:00

1 Answer 1

1

From the Drupal perspective, you just need to implement hook_cron():

function MYMODULE_cron() {
  drupal_http_request('http://foo.bar');
}

That will be invoked on all normal cron runs (there are situations when it won't, e.g. if you have a cron management module installed that limits core cron operations).

But it might make more sense just to wget/curl that URL on a separate single-line cron job. Depends on your use case, but either will probably be fine.

1
  • So seems that drush cron would actually run all the hook module crons. Is there a way to run only a particular hook_cron rather than all of the?
    – pal4life
    Jun 1, 2015 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.