[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Web servers again...



And Lo! The Great Prophet " Rob Keeling" uttered these words of wisdom:
>
>
> Yes, that was the way I was starting to think, unfortunately the 404 is
> really needed, unless I wanted
> to run a cron job every 5 mins or something.
>

I think, if you need to use groups as-is and you want it to run from PHP
handler, then a script that sets a trigger may be the best solution.

How this would work is up to you, but you'd have a daemon, or cron job,
that checks to see of a file exists or checks a FIFO (man mkfifo) for
data. If the file exists, or there's data in the FIFO, the daemon / cron
deletes the file / clears the FIFO and does it's stuff. This can run
safely as root.

Meanwhile, the PHP error handler, when fired, creates the file (can be
empty) or writes to the FIFO.

All the PHP will need is write perms to a single directory or to a FIFO.
If you use a FIFO, ensure you write the root process securely so that you
read all the data from the pipe without buffer overflows.

What you'll need to be careful of with a error-handler approach is that if
two people fire a 404 at the same time, or at least not that far apart,
you may have the issue of having two or more thumbnail-creation-scripts
running at once, so you'll also need a check in your daemon / cron job to
ensure you only ever have one of them running at once.

Chris...

-- 
\ Chris Johnson                 \
 \ cej [at] nightwolf.org.uk          \
  \ http://cej.nightwolf.org.uk/  ~-----------------------------------+
   \ Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000 \____

___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.