Re: script "chaining"
- From: bill <nobody@xxxxxxxxxxx>
- Date: Mon, 13 Jul 2009 06:38:36 -0400
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 ?
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.
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.
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 ?
- Re: script "chaining"
- From: Jerry Stuckle
- Re: script "chaining"
- Prev by Date: Re: PDO
- Next by Date: Re: script "chaining"
- Previous by thread: Re: script "chaining"
- Next by thread: Re: script "chaining"