how immediate does this need to be? unless this really needs to run
straight away, i'd put the "needs background work" request in a simple
queue and process it via a cron script. IMHO, putting a layer between
a web request and any serious out-of-band processing is the best way
to handle these cases.




You could set up a cron job to poll a php script hourly.

php /var/www/html/cron/cron.php

Have that script query a queue:

SELECT script_name, parameters FROM cron_table WHERE done = 'NO';

Iterate through the results and run the script(s):

foreach($results as $row)
{
   extract($row);
   // assuming the params are in the formate a:1/b:2/c:3
   $params = explode('/', $row['parameters']);

   // populate the variables that the script is expecting
   foreach($params as $p)
   {
      $z = explode(':', $p);
      $$p[0] = $p[1];
   }

   // include the script that actually does stuff
   include '/var/www/html/cron/' .  $row['script_name'];
}


Using this way you only have to set up one cron job and you can point it at any PHP script by just getting the page to insert a row in a database.

Just an idea, code probably is broken somewhere but anyway...

Cheers

P





--


*

www.recruitonline.com.au <http://www.recruitonline.com.au>
*

   * *Recruitment, Advertising, Document Managment, CRM, Online Storage
     and Search hosted services.*

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to