mySQL stored procedure... ??

I need to setup a server behaviour to send a notification to users when a mySQL stored date event has occured.
Namely: I have a start (datetime) and a duration (days) and once this event has expired (occured), I wish to fire a (php) function.

How can I setup this type of server-side behaviour? Thanx all...

Who is Participating?
e-tsikConnect With a Mentor Commented:
Hi :-)

1. Running PHP scripts not from a web page requires the php binary. The problem is, at least on Red Hat, the PHP binary does not come with the RPM and you will have compile PHP yourself.

2. You need to set up a cron job that runs every minute which fires up a program you will write in PHP. That program will look up the expired event and fire up that function you need
Put this in crontab -e
* * * * * /usr/local/bin/php /var/www/html/scheduler_script.php
Replace /usr/local/bin/php with the actual path to php.

The scheduler script will run the query that finds the expired events and run the function you require.

ARCglideAuthor Commented:
Thanks for your answer e-tsik... !!

The current setup is: Apache/2.0.50 (Unix) PHP/4.3.8 Server
Are there any further resources available on the net for setting up crontab within this environment??

Thanks again --ARCglide
ARCglideAuthor Commented:
Is this a method for the Apache setup to run scheduler_script.php once per minute ??

Use "crontab -e" is the normal command to setup the cron job.

Or you can do...
echo "1 * * * * lynx -dump" >> /var/spool/cron/`username`

Then use "crontab -l" to check the result.
Make sure your crond is running
/sbin/service crond start
chkconfig --level 2345 cron on

hmm. Might work, this IS a dirty hack, though...

I would have tried just putting
1 * * * * lynx -dump

In your crontab
ARCglideAuthor Commented:
E-tsik - thanks for the directional comments - I'll have a look into the use of (Apache) "crontab" and find the Apache 2.0 manual for more info.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.