Robert Cummings wrote:

>> >> #!/bin/sh
>> >> while true
>> >> do
>> >>     <yourscript>
>> >>     sleep 300
>> >> done
>> > 
>> > I accomplish the same with cron scripts by using locks with expiry.
>> 
>> got an example? my cat skinning skills need to be improved, the cat
>> won't like it but screw the cat, right?
> 
[snip code]
> I implemented my own lock class which uses directory creation and the
> return value to determine if the lock was successful. Unlike file
> creation (or so I read several years ago) directory creation is atomic
> and works across NFS. As an added benefit, I'm able to store lock
> related data into the lock directory as files.

I'm probably old fashioned, but to me all that stuff is way overkill.  I
also tend to think that synchronizing scripts is a job for the shell,
not PHP. 

lockfile=/var/lock/<xxxx>/file
# clear out a lock older than 60mins
find $lockfile -cmin +60 | xargs rm
test ! -f $lockfile && (
touch $lockfile
<run some php>
rm -f $lockfile
)


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to