Re: script "chaining"



Jerry Stuckle wrote:
bill wrote:
Jerry Stuckle wrote:
bill wrote:
Hugh Oxford wrote:
bill wrote:
The project I am converting from DataFlex to LAMP has a asynchronous daemon.

If a task (such as a report) would take too long to run while attached to the browser, the current system writes the data to a database file. The daemon checks that file every 10 seconds and executes the task, writing the data back to database (as a message or report).

Dataflex has the facility to chain to (execute) another Dataflex program so the daemon is small and fast. The daemon runs as a console program (CLI).

Does php have a similar function ?
Other suggestions ?

bill


If you take the A out of LAMP you can write a php script like a bash script or a perl script and execute it. There are a few differences in how you write it, but it's straightforward enough.

You could kick it off from a web browser using exec(), then use any number of methods to check on progress, just by querying the db.

I had a similar problem to yours, but I just used ajax. Because each ajax is its own http request, there isn't (such) a risk of timeout.

Ultimately however, I would recommend the first approach, but beware of the security caveats.

Indeed, I plan on having it run from cron, every 10 seconds.
The problem is figuring out a good (not even the best) way to invoke a whole bunch of different scripts after I interrogate the database to find out what is queued next.

Probably the worst way of doing things. But if you have a dedicated server, you should be able to do it.

I would gladly entertain ideas for improvement. Can't promise I can sell them, but am willing to try.

Situation:
Interactive web based (intranet only) system that generates "tasks" to be run off-line on a priority basis. Currently each task has its own script to run it.

I'm going to be spending the next year revising and upgrading the system so a few thoughts now will certainly help then.

bill


As Hugh said - you can have tasks kicked off from web pages.


reasonable approach except for the scheduled tasks that are not triggered by user intervention (daily, weekly, monthly, yearly).
I really don't look forward to trying to write the crontab file from a php script. Anyone ever done that ?

bill
.



Relevant Pages

  • Re: script "chaining"
    ... bill wrote: ... If a task would take too long to run while attached to the browser, the current system writes the data to a database file. ... The daemon checks that file every 10 seconds and executes the task, writing the data back to database. ... If you take the A out of LAMP you can write a php script like a bash script or a perl script and execute it. ...
    (comp.lang.php)
  • Re: script "chaining"
    ... If a task (such as a report) would take too long to run while attached to the browser, the current system writes the data to a database file. ... The daemon checks that file every 10 seconds and executes the task, writing the data back to database. ... If you take the A out of LAMP you can write a php script like a bash script or a perl script and execute it. ...
    (comp.lang.php)
  • Re: script "chaining"
    ... If a task (such as a report) would take too long to run while attached to the browser, the current system writes the data to a database file. ... The daemon checks that file every 10 seconds and executes the task, writing the data back to database. ... If you take the A out of LAMP you can write a php script like a bash script or a perl script and execute it. ...
    (comp.lang.php)
  • Re: How to display web page continuosly?
    ... the script to finish before displaying the report. ... make my browser display the web page every few seconds and update ...
    (comp.lang.php)
  • Re: script "chaining"
    ... If a task (such as a report) would take too long to run while attached to the browser, the current system writes the data to a database file. ... The daemon checks that file every 10 seconds and executes the task, writing the data back to database. ... If you take the A out of LAMP you can write a php script like a bash script or a perl script and execute it. ...
    (comp.lang.php)