Re: Re: skinning a cat (was: Individual bulk e-mails - performance question)
| From: | Robert Cummings | Date: | Mon, 01 Sep 2008 17:03:07 +0000 |
| Subject: | Re: Re: skinning a cat (was: Individual bulk e-mails - performance question) | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-279227@lists.php.net to get a copy of this message | ||
On Mon, 2008-09-01 at 09:44 +0200, Per Jessen wrote:
> 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
> )
Try running that on windows.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP