Re: [PHP] Run script every 30 seconds
- From: phpmail@xxxxxxxxxxxxxxxxxxxxxxx (David Otton)
- Date: Mon, 30 Oct 2006 19:59:07 +0000
On Mon, 30 Oct 2006 21:26:29 +0300, Ahmad Al-Twaijiry wrote:
The "right" way to do this, as others have mentioned, is with a
daemon. Having said that...
is it possible to link the script to my php interface (the one that
the users is using it) and if the php interface page will run the
script (IN background) if it didn't run for the last 30 seconds ? I
see this is very hard and almost impossible , what do you think ?
http://www.webcron.org/
However, an admin on a shared host may (quite rightly) kick you for
wasting shared resources.
A script that has to be run every 30 seconds sounds like it's covering
for a bad design decision to me. Can you tell us more about what
you're trying to accomplish? We might be able to find a more elegant
solution.
PS: also I need to make sure no more than 1 process of the script is running :)
Locking. At its simplest, have your script create a dummy file when it
first runs, and delete it when it exits. If the file already exists,
then you know that a copy of your script is already running, so you
exit. (Include a timeout in case the script dies halfway through - if
the file is more than 5 minutes old, run anyway).
.
- References:
- Run script every 30 seconds
- From: "Ahmad Al-Twaijiry"
- Re: [PHP] Run script every 30 seconds
- From: Dave Hamber
- Re: [PHP] Run script every 30 seconds
- From: "Ahmad Al-Twaijiry"
- Run script every 30 seconds
- Prev by Date: Re: [PHP] Run script every 30 seconds
- Next by Date: Re: [PHP] str_replace on words with an array
- Previous by thread: Re: [PHP] Run script every 30 seconds
- Next by thread: Re: [PHP] Run script every 30 seconds
- Index(es):
Relevant Pages
|