Re: time driven execution of a script.
| From: | Daniel Convissor | Date: | Wed, 11 Oct 2000 15:06:12 +0000 |
| Subject: | Re: time driven execution of a script. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19613@lists.php.net to get a copy of this message | ||
Hi Mano:
> If i want to execute a script for every, say, 30 min, how do i do
> that.Exactly, i have to execute a script after getting five inserts in a
> database table or 30 min- whichever is earlier. How should i do this?
If PHP's installed as a standalone binary (ie CGI mode) you can use scheduler
in Windows or cron in Linux to call your script using something like
"c:\php\php.exe d:\bat\script.php"
This works on a timed basis, but doesn't handle your 5 inserts situation.
To do that, you may want to put a separate table in your database that
contains a field with a counter in it. When your primary insert script is
running, it queries that table and finds out the counter value. If less than
5, just increment counter and do insert. But if the counter is at 5, reset
counter to 0, do the insert, then execute secondary script.
Guess combining the two approaches will get close to what you want.
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
More than just answers. Solutions. (SM)
http://www.analysisandsolutions.com/
4015 7 Av #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409