1

Is there any way to schedule a particular sub-module to run at a specific time? I found hook_cron but it seems to rely on a scheduled cron job in crontab to run cron.php and then cron.php calls hook_cron. I have multiple sub-modules that I would like to schedule to run, all at different times. The scheduled times are user-inputted from the front and processed in the main module. Because of this, for hook_cron to work, I would need to pass in parameters from the main module (based on what the user inputted)

Any help is appreciated.

I am using Drupal 6

2

Depending on how detailled your specific time is, you could still use hook_cron. For example, let's say the normal cron runs every hour, you could check date('H') in your module and only if it equals a predefined value, the cron function in your submodule will be executed.

function MYMODULE_cron() {
  if (date('H') == 3) {
    // this code will only be executed between 3:00am and 3:59am
    // do your stuff
  }
}
|improve this answer|||||
  • I updated the question with more details; sorry I did not mention it; basically I need to pass in parameters to hook_cron to set the times. – user3786924 Oct 23 '14 at 17:11
0

Take a look at Ultimate Cron - I think it does what you want.

|improve this answer|||||
  • thanks...will check it out and also with management if additional 3rd party modules are ok. – user3786924 Oct 23 '14 at 17:13

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.