Re: [PHP] only one at atime
- From: bbonkoski@xxxxxxxxxxxxxx (Brad Bonkoski)
- Date: Mon, 30 Oct 2006 13:48:48 -0500
Ahmad Al-Twaijiry wrote:
Hi everyone,Nope, typically this is how you solve the problem you mentioned... (just make sure the /tmp directory (or specifically your file are remove when you boot up)
I create a php script that will run every minute (by cronjob) and
update some database tables (php 5, database mysql 5, tables type
innodb)
the problem is that I want this script to run only one at atime (only
one process from this script can run )
for example, if the cronjob start the script and the script takes more
than one minute, then after this one minute the cronjob start another
process from this script, it should exit once it find there is an old
process of it running)
what I do now is that when the script start it will check for a tmp
file (/tmp/script.pid) and if it fine it it will exit.
if the file (/tmp/script.pid) is not exists, it will create it and
start doing the database update
and when the script finish it will remove the file
any better idea ?
Thanks
I have seen instances where the machines reboot in the middle of the script and then don't execute for a while because of this *lock file*.
-B
.
- References:
- only one at atime
- From: "Ahmad Al-Twaijiry"
- only one at atime
- Prev by Date: Re: [PHP] Run script every 30 seconds
- Next by Date: Re: only one at atime
- Previous by thread: only one at atime
- Next by thread: Re: only one at atime
- Index(es):
Relevant Pages
|