Run cron job for a specific module.
Hi all,
I'm developing a site with Drupal that has a stock index "quoter" on the front page. I've successfully installed the stockapi module to store information from Yahoo Finance and I'm making my own module to display that information.
Right now, I haven't got a cron job setup on my server to run in scheduled intervals. I would like to have the stock prices update every 15 minutes (or possibly more often), but I don't want the site to run a full cron job every 15 minutes. I've been unable to find any sort of documentation on this, but is it possible to just run the cron for the stockapi module and not the whole site? If so, where do I begin?
I guess to preface the above question I must ask if it is even an issue to run a full cron job 4 times or more per hour. From what I've read in the documentation it seems that once per hour is the norm.
Any thoughts or suggestions would be greatly appreciated.
Thanks,
Damien

=-=
I run a full cron job every 15 mins on sites as a norm. this runs the search index and such, so I wouldn't want anything left out of search for much longer.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
create your own cron.php
I've had to deal with a similar situation before. In order to get around it, I created an additional cron script that executed /only/ the function I wanted run frequently.
First, change the name of the function in your module from modulename_cron() to modulename_custom_cron() or something like that so it doesn't get executed when the normal cron runs. In the same directory where cron.php exists (the root directory of your Drupal installation), create a new script (mine is called mls_cron.php [mls is the name of my module]). Copy/paste the contents of cron.php into the new file. Replace the line 'drupal_cron_run();' with 'modulename_custom_cron();'. Then, create a cronjob that calls your new script every 15 minutes.
Thanks for the help. It is
Thanks for the help. It is working great!