newbie: timed alerts

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
This question probably doesn't belong in this forum, but since I'm
planning on using php as my main site implementation tool, I thought it
would be a good place to start. I'm new to php, and am looking to setup
a small/medium sized PHP-mySQL driven site.

One of the aspects of this site will be that registered users will be
able to store times when they want to receive emailed alerts. These
times will be stored in the database...easy enough. My question is:
what's the best way to setup the functionality of triggering the
alerts? I don't really know where to start.

I would assume that I need to have some executable running in the
background that periodically (say once every minute) polls the
database, and acts on any scheduled alerts that have come due by
sending the emails. Also, since I need to run such a program, any
possibility of hosting this site on someone else's server is probably
out, right?

I'm sure lots of people have dealt with similar situations. What's the
standard approach?

Like I said, it's not really a php question. But I would appreciate any
direction anyone would be willing to offer. Thanks in advance.

Re: newbie: timed alerts wrote:
Quoted text here. Click to load it

The usual way to do this is with cron which allows you to run a program  
at specified periods.  You will have to check with your hosting service  
whether they provide cron, many do.

1 minute intervals is probably a bit too much, do you *really* need the  
email to go out on the exact minute?  The hosting companys also get a  
little nervous about such frequent processes.  5 minutes is usually enough.


Re: newbie: timed alerts

You indeed need a program which wakes up every minute to send e-mails.
You do not need to query the database every minute, just hold the data
for this hour in memory. You can run this program on somebody's server,
as long as they give you a shell account (SSH or the like).

Re: newbie: timed alerts

Groovy. Yeah - one minute is probably too much. Thanks for the advice,

Site Timeline