Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: system or exec in a web environment

by paulbort (Hermit)
on Jun 09, 2004 at 13:58 UTC ( #362729=note: print w/replies, xml ) Need Help??

in reply to system or exec in a web environment

The other monks are correct, 'exec' never returns. Never.

I would suggest changing the CGI script to give the user a message like "Your file is being processed" and just end.

Then in the background, you need a listener program that watches that directory for new files, picks them up in turn, and processes them. The one I wrote is a shell-script that runs a Perl script every 10 seconds, and is started by rc.local. If you want it to process multiple files at a time, a thread pool can be your friend.

If you need to keep users informed about how their files are going, a CGI script that displays results from a status table, updated by the worker threads, might make sense. (You could even make it part of the original script with a refresh, if you want that 'interactive application' style.)

Spring: Forces, Coiled Again!
  • Comment on Re: system or exec in a web environment

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://362729]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2019-07-19 01:30 GMT
Find Nodes?
    Voting Booth?

    No recent polls found