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.

  • What do you mean by "run a particular page"? – Clive Jun 1 '15 at 14:58
  • Updated to clarify that to invoke a certain url – pal4life Jun 1 '15 at 15:00
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.

  • 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 '15 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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