By jbowman on
For a site I'm working on, I'm heavily using feedapi to aggregate news for my site. I'm pulling and parsing enough feeds that I can see that running 1 cron job to handle everything really isn't going to be efficient. I've been searching for information on running different cron tasks at different time.
For example, I'm building a sports site that hits rss feeds for each individual team. Is there a way to set it so I have a cron that runs at 01 that grabs my nfl teams, 15 for baseball, 30 for basketball, and so forth and so on?
Comments
As far as I know, there
As far as I know, there isn't a way to tell cron to run specific tasks at specific times.
Cron is just a scheduling mechanism.
Why not just set your cron job to run more frequently?
Alternatively, write a new version of cron.php that grabs the required stuff and then stick this file in your crontab?
So, in the root of your site you'd have cron.php set to run every 12 hours or whatever, cron-nfl.php to run at 01 minutes, cron-baseball.php to run at 15 minutes past the hour, etc
This could get a bit tricky though so I personally would just set the cron job to run more frequently at certain times of the day (like after the games are due to be played)
As far as I know, there
As far as I know, there isn't a way to tell cron to run specific tasks at specific times.
Cron is just a scheduling mechanism.
Why not just set your cron job to run more frequently?
Alternatively, write a new version of cron.php that grabs the required stuff and then stick this file in your crontab?
So, in the root of your site you'd have cron.php set to run every 12 hours or whatever, cron-nfl.php to run at 01 minutes, cron-baseball.php to run at 15 minutes past the hour, etc
This could get a bit tricky though so I personally would just set the cron job to run more frequently at certain times of the day (like after the games are due to be played)
I'd probably have to go with
I'd probably have to go with the option of separate cron tabs. It's a lot of feeds, and when I'm done, I don't think I'll get them all to run in one instance before php times out. I was hoping there was already something out there module wise for the other option you presented. Thanks for the response!
The first thing I'd do is
The first thing I'd do is suggest it to the developers, (before you attempt the individual cron jobs)!!
Then write your separate cron files (using the original cron.php as a skeleton), but don't include the last line so, something like:
The after this, I'd do something like
where $nid_of_the_nfl_feed is, well, the nid of the needed feed
In theory, this should work, but it's totally untested. If it does work, then put this file in your crontab at the specified time
Let me know how you get on
Cheers