How do I create a Daemon for my php rss reader?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bobby613
Forum Newbie
Posts: 2
Joined: Fri Apr 25, 2008 1:02 am

How do I create a Daemon for my php rss reader?

Post by bobby613 »

hi everyone.

What's the best implementation for creating a php daemon?

Here's my desired use case:

A thread sleeps every 20 minutes, and upon waking up, updates the rss feed in the database.

My ackward solution so far is to have a php class check and updates the rss feed for every site visitor. This is not optimal, since each web visitor will trigger a check-update process. Instead, I'd like to have one seperate thread responsible for the check-update process.

help.

What would be a better implementation.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: How do I create a Daemon for my php rss reader?

Post by Eran »

There are two possible ways to handle this -
1. Put a timestamp on the RSS update. Next time only update if 20 minutes have passed since the last update (meaning - check for every user, update only every 20 minutes).
2. Use a cron job. A cron job is an automated unix process that runs periodically (alternatively you have task scheduler on windows). An introduction to cron jobs - http://www.unixgeeks.org/security/newbi ... ron-1.html
Post Reply